Timely identification of patients who are at risk of mental health crises opens the door for improving the outcomes and for mitigating the burden and costs to the healthcare systems. Due to high prevalence of mental health problems, a manual review of complex patient records to make proactive care decisions is an unsustainable endeavour. We developed a machine learning model that uses Electronic Health Records to continuously identify patients at risk to experience a mental health crisis within the next 28 days. The model achieves an area under the receiver operating characteristic curve of 0.797 and an area under the precision-recall curve of 0.159, predicting crises with a sensitivity of 58% at a specificity of 85%. The usefulness of our model was tested in clinical practice in a 6-month prospective study, where the predictions were considered clinically useful in 64% of cases. This study is the first one to continuously predict the risk of a wide range of mental health crises and to evaluate the usefulness of such predictions in clinical settings.