The recent financial crisis has highlighted the key role of leveraged financial institutions as liquidity providers. We incorporate leveraged financial institutions into a dynamic general equilibrium portfolio choice model in order to analyze the dynamics of risk, leverage, liquidity and asset prices. We particularly emphasize the role of self-fulfilling changes in expectations that can lead to sudden large shifts in risk, liquidity and leverage. This can take the form of a financial panic with a big drop in asset prices. Such panics become much more severe when taking place against the backdrop of leveraged institutions that are in weak financial health. We show that the model can account for the main features of the current crisis, both during the panic and pre-panic stages of the crisis.