This paper examines how much capital banks should optimally hold. Our model encompasses different kinds of moral hazard studied in banking: asset substitution (or risk shifting, e.g., making risky, negative net present value loans), managerial rent seeking (e.g., shirking or investing in inefficient “pet” projects that yield private benefits), and the free cash flow problem (manifesting as inefficient consumption of cash for perquisites by the manager). The privately optimal capital structure of the bank balances the benefit of leverage as reflected in the market discipline imposed by uninsured creditors on rent seeking on the one hand and the cost of leverage as reflected in the asset substitution induced at high levels of leverage on the other hand. Under some conditions, the capital structure resolves all the moral hazard problems we study, but under other conditions, the goal of having the market discipline of leverage clashes with the goal of having the benefit of equity capital in attenuating asset substitution moral hazard. In this case, private contracting must tolerate some form of inefficiency and bank value is not maximized as it is in the first best. Despite this, there is no economic rationale for regulation. However, when bank failures are correlated and en masse failures can impose significant social costs, regulators may intervene ex post via bank bailouts. Anticipation of this generates multiple Nash equilibria, one of which features systemic risk in that all banks choose inefficiently high leverage, take excessively correlated asset risk, and, because debt is paid off by regulators when banks fail en masse, market discipline is compromised. While a simple minimum (tier-1) capital requirement suffices to restore efficiency under some conditions, there are also conditions under which an optimal arrangement to contain the build-up of systemic risk takes the form of the regular (tier-1) capital requirement plus a “special capital account” that involves 1) building up capital via dividend payout restrictions, 2) investment of the retained earnings in designated assets, and 3) contingent distribution provisions.