We investigate the role of macroprudential policies in mitigating liquidity traps driven by deleveraging, using a simple Keynesian model. When constrained agents engage in deleveraging, the interest rate needs to fall to induce unconstrained agents to pick up the decline in aggregate demand. However, if the fall in the interest rate is limited by the zero lower bound, aggregate demand is insufficient and the economy enters a liquidity trap. In such an environment, agents' exante leverage and insurance decisions are associated with aggregate demand externalities. The competitive equilibrium allocation is constrained inefficient. Welfare can be improved by ex-ante macroprudential policies such as debt limits and mandatory insurance requirements. The size of the required intervention depends on the differences in marginal propensity to consume between borrowers and lenders during the deleveraging episode. In our model, contractionary monetary policy is inferior to macroprudential policy in addressing excessive leverage, and it can even have the unintended consequence of increasing leverage.