We develop a two-period model where banks invest in reserves and loans, and are subject to aggregate liquidity shocks. When banks face a a shortage of liquidity, they can sell loans on the interbank market. Two types of equilibria emerge. In the no default equilibrium, banks keep enough reserves and remain solvent. In the mixed equilibrium, some banks default with positive probability. The former equilibrium exists when credit market competition is intense, while the latter emerges when banks exercise market power. Thus, competition is beneficial to financial stability. The effect of default on welfare depends on the exogenous risk of the economy as represented by the probability of the good state of nature.