We use a dataset of 12 million residential mortgages to investigate the loan default behavior in several European countries. We model the default occurrence as a function of borrower characteristics, loan-specific variables, and local economic conditions. We compare the performance of a set of machine learning algorithms relative to the logistic regression, finding that they perform significantly better in providing predictions. The most important variables in explaining loan default are the interest rate and the local economic characteristics. The existence of relevant geographical heterogeneity in the variable importance points at the need for regionally tailored risk-assessment policies in Europe.