We investigate a simple dynamical model for the systemic risk caused by the use of Value-at-Risk, as mandated by Basel II. The model consists of a bank with a leverage target and an unleveraged fundamentalist investor subject to exogenous noise with clustered volatility. The parameter space has three regions: (i) a stable region, where the system has a fixed point equilibrium; (ii) a locally unstable region, characterized by cycles with chaotic behavior; and (iii) a globally unstable region. A calibration of parameters to data puts the model in region (ii). In this region there is a slowly building price bubble, resembling the period prior to the Global Financial Crisis, followed by a crash resembling the crisis, with a period of approximately 10–15 years. We dub this the Basel leverage cycle. To search for an optimal leverage control policy we propose a criterion based on the ability to minimize risk for a given average leverage. Our model allows us to vary from the procyclical policies of Basel II or III, in which leverage decreases when volatility increases, to countercyclical policies in which leverage increases when volatility increases. We find the best policy depends on the market impact of the bank. Basel II is optimal when the exogenous noise is high, the bank is small and leverage is low; in the opposite limit where the bank is large and leverage is high the optimal policy is closer to constant leverage. In the latter regime systemic risk can be dramatically decreased by lowering the leverage target adjustment speed of the banks. While our model does not show that the financial crisis and the period leading up to it were due to VaR risk management policies, it does suggest that it could have been caused by VaR risk management, and that the housing bubble may have just been the spark that triggered the crisis.