Alan Greenspan argues that the crisis was unpredictable and inevitable, given the ‘excessive’ leverage of the financial intermediaries. I focus upon the housing sector, which has been at the origin of the financial crisis because the value of the financial derivatives ultimately depended upon the ability of the mortgagors to repay their debts. The uncertainty concerns the capital gains – housing price appreciation – and the rate of interest. I explain why the application of stochastic optimal control (SOC) is an effective approach to determine the optimal degree of leverage, the optimum and excessive risk and the probability of a debt crisis. I show that the theoretically derived early warning signal of a crisis is the excess debt ratio, equal to the difference between the actual and optimal ratio. The excess debt of households starting from 2004-05 indicated that a housing crisis was most likely.