This paper investigates the association between several mental health indicators (depression, anxiety, stress, and loneliness) and the overall tendency to follow official recommendations regarding self-protection against COVID-19 (i.e., overall compliance). We employ panel data from the COME-HERE survey, collected over four waves, on 7,766 individuals (22,878 observations) from France, Germany, Italy, Spain, and Sweden. Employing a flexible specification that allows the association to be non-monotonic, we find a U-shaped relationship, in which transitions to low and high levels of mental health are associated with higher overall compliance, while transitions to medium levels of mental health are associated with less overall compliance. Moreover, anxiety, stress, and loneliness levels at baseline (i.e., at wave 1) also have a U-shaped effect on overall compliance later (i.e., recommendations are followed best by those with lowest and highest levels of anxiety, stress, and loneliness at baseline, while following the recommendations is lowest for those with moderate levels of these variables). These U shapes, which are robust to several specifications, may explain some of the ambiguous results reported in the previous literature. Additionally, we observe a U-shaped association between the mental health indicators and a number of specific health behaviours (including washing hands and mask wearing). Importantly, most of these specific behaviours play a role in overall compliance. Finally, we uncover the role of gender composition effects in some of the results. While variations in depression and stress are negatively associated with variations in overall compliance for men, the association is positive for women. The U-shaped relation in the full sample (composed of males and females) will reflect first the negative slope for males and then the positive slope for females.