Anyone who's ever gone for a long, satisfying run and felt that rush of feel-good endorphins flood their body knows the power a good workout can have on their entire mood. Countlessstudies have found a demonstrable link between physical activity and mental health—more of one is associated with more of the other—but the science has struggled to prove a causal connection. Does more exercise cause better mental health, or do people who already have better mental health just tend to exercise more?

But now, finally, we have some pretty strong evidence: Exercise really may prevent depression, a new study shows.

Published today in the JAMA Psychiatry journal, the study used a type of genetic analysis to prove the causal link. Using the results of large-scale genome-wide association studies, researchers identified gene variants relating to physical activity and depression. There was a lot of data involved: One measure of physical activity was based on 377,000 people's self-reported documentation of their physical activity; another was based on 91,000 people wearing motion-detecting sensors on their wrists, and the depression measure was based on 143,000 people with and without the illness.

The analysis showed that more physical activity clocked in on the motion sensors appeared to protect against the risk of depression, but the relationship did not work the other way around—depression did not lead to less physical activity. Interestingly, people's self-reported physical activity also didn't lead to less risk of depression, perhaps because people don't always honestly report how much they've exercised and don't always know to include all the strenuous activity they do throughout the day that gets the heart pumping—things like climbing up a lot of stairs, mowing the lawn, or other activities a motion sensor will still register.

On average, "doing more physical activity appears to protect against developing depression," says Karmel Choi, Ph.D., the report's lead author and a postdoctoral fellow in the Psychiatric and Neurodevelopmental Genetics Unit at the Massachusetts General Hospital Center for Genomic Medicine, in a news release. "Any activity appears to be better than none; our rough calculations suggest that replacing sitting with 15 minutes of a heart-pumping activity like running, or with an hour of moderately vigorous activity, is enough to produce the average increase in accelerometer data that was linked to a lower depression risk."

Considering nearly one in five people in the United States live with mental illness and about one in 12 adults report having depression specifically, these findings offer an important preventive strategy for anyone looking to protect their mental health.

"Of course, it's one thing to know that physical activity could be beneficial for preventing depression; it's another to actually get people to be physically active," Dr. Choi says. "More work needs to be done to figure out how best to tailor recommendations to different kinds of people with different risk profiles. We currently are looking at whether and how much physical activity can benefit different at-risk groups, such as people who are genetically vulnerable to depression or those going through stressful situations and hope to develop a better understanding of physical activity to promote resilience to depression."

While the scientists keep working out the details, the actionable take-away for most people is fairly clear: Get moving. Building physical activity into your day is key to a healthy body and mind, no questions asked.

If you're someone already with depression, holistic psychiatrist and mbg Collective member Ellen Vora, M.D., still recommends working some movement into your day—but emphasizes the importance of setting achievable expectations.

"When you're depressed, the last thing you want to do is haul yourself to the gym for a spin class," Dr. Vora tells mbg. "Commit to doing something quick, free, easy, convenient, and pleasant in your living room for a few minutes most days of the week. I suggest anything from Pilates to calisthenics to yoga to dancing along to a Beyoncé music video on YouTube. If you do anything at all, you'll begin to get the antidepressant benefits, and I assure you doing something—no matter how small—is so much better than nothing."