The cost of enforcing contracts is a key determinant of market performance. We document this point with reference to the credit market in a model of opportunistic debtors and inefficient courts. According to the model, improvements in judicial efficiency should reduce credit rationing and increase lending, with an ambiguous effect on interest rates that depends on banking competition and on the type of judicial reform. These predictions are supported by panel data on Italian provinces and by cross-country evidence. In Italian provinces with longer trials or large backlogs of pending trials, credit is less widely available. International evidence also shows that the depth of mortgage markets is inversely related to the costs of mortgage foreclosure and other proxies for judicial inefficiency.