This paper provides a framework to analyse emergency liquidity assistance of central banks on financial markets in response to aggregate and idiosyncratic liquidity shocks. The model combines the microeconomic view of liquidity as the ability to sell assets quickly and at low costs and the macroeconomic view of liquidity as a medium of exchange that influences the aggregate price level of goods. The central bank faces a trade-off between limiting the negative output effects of dramatic asset price declines and more inflation. Furthermore, the anticipation of central bank intervention causes a moral hazard effect with investors. This gives rise to the possibility of an optimal monetary policy under commitment.