Get your eight hours of sleep each night. That's the usual message, because with enough sleep comes a whole host of health benefits.

But sleep quality may actually be the most important factor predicting good mental health, more so than hours slept, physical activity, and diet, according to a new study of young adults from researchers at the University of Otago in New Zealand.

Disrupted sleep has been linked to poor mental health before, including depression and other mood disorders. Eating a well-rounded diet has also been shown to help prevent depression, and even short bouts of exercise can boost your mental and physical health.

But sleep, diet and exercise are a complex set of behaviours that are inseparable in real life.

Although we've seen many studies before this looking at what affects our mental health, one factor at a time, this new study considers three lifestyle factors – sleep, diet and exercise – in one analysis in a bid to understand which one has the biggest impact on mental health among young adults.

"Sleep, physical activity, and a healthy diet can be thought of as three pillars of health, which could contribute to promoting optimal well-being among young adults," said lead author Shay-Ruby Wickham, from Otago Medical School.

"While extensive research has shown the mental health and wellbeing benefits of sleep, physical activity, and diet as individual predictors, research examining all three behaviours together…is limited," the team explained in their paper.

"Knowing the importance of each of these lifestyle behaviours, singularly or in combination with each other, and the hierarchical order of importance will inform mental health interventions at both the population and individual level," they added.

Some previous research suggests healthy behaviours such as eating well or exercising often can have a synergistic effect on wellbeing, where more of one good thing leads to other positive change.

But another possibility is that some healthy behaviours might compensate for other not-so-great choices, like the meal you smash after a hard workout.

In this study, the researchers surveyed more than 1,100 young adults aged between 18 and 25 years old to compare 'the big three' health factors impacting mental health side-by-side.

People completing the online survey between 2018 and 2019 were asked about their mood and wellbeing, diet, exercise and sleeping habits. They also reported how refreshed they typically felt after waking up each morning, which is an established indicator of good quality sleep.

Maintaining good mental and physical health isn't easy for young adults who typically experience big changes to their daily routines, sleep patterns, work demands, lifestyle and living situations at a critical time in development.

The study participants, living in the United States and New Zealand, were a mixed bunch: some were already eating a vegetarian or vegan diet; others were taking anti-depressants for existing health conditions; and less than one third identified as male. But the researchers made adjustments in their analysis to account for these differences.

People who slept close to 10 hours per night reported fewer depressive symptoms, but not enough (12 h) had people reporting more symptoms of depression.

Eating moderate servings of raw fruit and veg each day also correlated with better wellbeing.

And while physical activity was the second clearest indicator of wellbeing, it was sleep quality that outranked them all as the strongest predictor of good mental health.

"This is surprising because sleep recommendations predominantly focus on quantity rather than quality," said Wickham.

Since the study didn't make any changes to people's sleep, activity or diet, we can only draw links between behaviours and outcomes, and cannot attribute causes.

Cautiously, the researchers suggest in their paper that young adults should prioritise getting good quality sleep, but they also stress the importance of eating well and exercising often since "physical activity and diet are secondary but still significant factors."

"Our findings suggest that future lifestyle interventions targeting sleep quality may be most beneficial at improving mental health and wellbeing. However, physical activity and diet should not be disregarded," the researchers wrote.

The findings of this study are based solely on people's responses to a set of questions, and not the results of any direct observations or health assessments. Some parts of the questionnaire only had a single question – designed to encourage more people to respond – and so more comprehensive measures are really needed to investigate further.

The University of Otago researchers have actually begun analysing data from another study of young New Zealand adults, which involved assessing their wellbeing, lifestyle, diet, sleep and exercise every day for two weeks – but that follow-up study has not yet been peer reviewed.

In the meantime, we can all rest easy knowing a few simple ways to improve the quality of our sleep: create a routine that includes time to wind down after dark, and put away screens and dim lights before bed.

The research was published in Frontiers in Psychology.