Around a third of adults struggle to get enough sleep on any given night. For many of us, it’s a short-lived problem. But clinical insomnia—defined as persistent difficulty falling and staying asleep, with additional negative effects for daytime functioning—affects 5 to 10 percent of adults.

We know that people with insomnia are more likely to develop a wide range of mental health problems. The risk of developing depression, for instance, doubles. It’s well established that people with psychological disorders tend to sleep badly. What’s less clear is why.

The conventional view among mental health professionals is that where sleep problems co-exist with other psychological difficulties, insomnia is essentially a product of them: you can’t sleep because you’re anxious, for example, or because your depression means that you’re not physically active during the day.

That means insomnia languishes way down in the list of problems to be tackled. Indeed, there’s no pressing need to deal with them. The assumption has been that when the depression lifts or the anxiety abates, sleep will automatically improve.

But now it seems that we may have been putting the horse before the cart. Insomnia may not simply be a result of psychological disorders: it may also help cause them.

This week in the Lancet Psychiatry, we report on what may be the largest randomized controlled trial of an intervention for a mental health issue. Conducted at the University of Oxford’s Sleep and Circadian Neuroscience Institute, with support from colleagues in universities across the UK and funding from the Wellcome Trust, we recruited over 3700 students with insomnia from 26 British universities. Half were assigned a course of web-based cognitive behavioral therapy for insomnia. (CBT is the clinically recommended first-line treatment for insomnia.) For the other participants, it was “business as usual,” which in most cases meant minimal treatment.

The digital treatment we offered the students is called Sleepio. It’s made up of six short sessions accessed on a weekly basis, though participants can take things more slowly if they like. The program is personalized, but essentially it boils down to three areas: changing behavior, altering the way we think about our sleep and sleeplessness, and also providing general guidance on what sleep is and how best to go about getting enough of it.

Under the “behavior” heading participants tried techniques designed to build an association between being in bed and sleep (rather than sleeplessness). For example, if you’re not sleeping after twenty minutes, you don’t lie there worrying: you get up and do something relaxing instead. And you limit the amount of time you spend in bed to the number of hours sleep you’re currently getting—say six hours. Once you’re sleeping for all or most of those six hours in bed, you can gradually build it up.

Different cognitive strategies were used to help the participants reassess the way they viewed the business of getting to sleep. Mindful meditation was featured, for example, and so too was encouraging people to put time aside to reflect on their day before going to bed. We also asked participants to reflect upon and challenge some less helpful beliefs about sleep, like “If I don’t get at least eight hours I won’t be able to function,” for example. 

We assessed participants for six months. What we found was striking. The students assigned the CBT course reported much lower levels of insomnia. That was no surprise, but what we were really interested in were the effects on other psychological problems. And indeed the participants who received the sleep treatment were also less likely to report excessive mistrust, hallucinatory experiences, anxiety, depression, and nightmares. Their level of happiness was improved and they could function better too. Improvements in sleep were large; for the other problems we tended to see small to moderate gains.

We don’t know whether our results would have been different with a more diverse set of participants, though there’s no strong reason to suppose that they would. What is evident, though, is that the current view of sleep problems needs radical revision. Insomnia isn’t the sole cause of complex psychological problems. But the idea that insomnia is merely a product of these other difficulties doesn’t stack up. Experiencing insomnia isn’t an inevitable precursor to mental health issues. Sleeping badly doesn’t mean you’ll develop depression or start hearing voices. But for many people insomnia can be part of the complex package of causes. A vicious cycle can emerge: because you’re exhausted, your psychological problems feel even more intense—which in turn makes it harder to get a proper night’s rest.

How exactly does sleeplessness harm mental health? We can point to certain plausible mechanisms, which reinforce the idea of a causal connection. Lack of sleep can have a profound effect both on the content of our thoughts and how we process them. Thoughts are skewed to the fearful and downbeat, and processing is more likely to include repetitive loops of negative thinking, or rumination This, in turn, makes experiencing negative emotions more likely. It also seems that the kind of genetic and environmental factors that can play a part in insomnia are implicated in other psychological problems.

We need much more research into these mechanisms. Undeniably, we also need sleep problems to be taken more seriously by health professionals. After all, insomnia is almost uniquely free from stigma. It’s the one psychological problem most people are happy to own up to. Treat that and you’re potentially nipping in the bud a host of other issues.

On an individual level, the study is a reminder of how important quality sleep is for our mental health. Without wanting to be preachy, cutting corners on sleep is a misstep. We need to put the same value on sleep as we do on, say, sensible nutrition and regular exercise—and especially if we’re going through tough times. If sleep isn’t happening for us for a prolonged period, it’s sensible to seek help. Not only will we sleep better, we could be saving ourselves a great deal of distress further down the line.

Daniel Freeman is a Professor of Clinical Psychology and NIHR Research Professor at the University of Oxford. Jason Freeman is a writer and editor. Follow the brothers @ProfDFreeman and @JasonFreeman100 on Twitter.