The Basel Accords promote the adoption of capital adequacy requirements to increase the banking sector's stability. Unfortunately, this type of regulation can hamper economic growth by shifting banks' portfolios from more productive, risky investment projects toward less productive but safer projects. This paper introduces banking regulation in an overlapping-generations model and studies how it affects economic growth, banking sector stability, and welfare. In this model, a banking crisis is initiated by an aggregated shock (in the risky sector) in a banking system with implicit bailout, and banking regulation is modelled as a constraint on the maximal share of banks' portfolios that can be allocated to risky assets. This model allows us to evaluate quantitatively the key trade-o®, inherent in this type of regulation, between ensuring banking stability and fostering economic growth. The model implies an optimal level of regulation that prevents crises but at the same time is detrimental to growth. We find that the overall effect of optimal regulation on social welfare is positive when productivity shocks are sufficiently high (for example, in the subprime banking crisis episode) and economic agents are sufficiently risk averse. Finally, we find that there is a trade-off between regulating the economy upfront (i.e. before the shock) and facing the challenge of making a huge bailout after the crisis.