Résumé : This research investigates how bankruptcy law influences the design of debt contracts and the investment choice through the sanction of faulty managers. We model a lending relationship between a small firm and a monopolistic bank which decides the loan rate. The firm may perform asset substitution, which is punished by the Law through legal sanctions. These sanctions are implemented in case of costly bankruptcy only. This way of resolving financial distress can be avoided yet, if a private agreement is achieved. First, – when sanctions are high – we show that costly bankruptcy may be preferred by honest firms over private negotiation. Thus costly bankruptcy cannot be avoided under a severe legal environment. However, as the bank internalizes the rules of default, debt contracts are designed so that this situation never happens at equilibrium (“legal efficiency”). Second, a peculiar legislation may incite banks to accept generalized moral hazard (“economic inefficiency”). Then, the legislator can indirectly enforce economic efficiency. However he must consider effects beyond the simple comparison between legal sanctions and bankruptcy costs, and focus on the impact of such legal sanctions on the design of the debt contract. Simulated results show that even small changes of legal sanctions may have drastic effects on the firm’s investment policy. Besides, it appears that extreme severity (i.e. 100% of the manager’s wealth is subject to legal sanctions) is not needed to ensure economic efficiency. Last, in some cases, the legislator may have the choice between several levels of legal sanctions all leading to economic efficiency: when choosing between them, the legislator affects the profit sharing only.