Just about everyone who lives in a city can say there are times when it becomes emotionally taxing. Long commutes, tight living spaces, and unpleasant interactions with others are only some of the reasons so many people can’t wait to get out of the city for vacation — many times ending up in areas surrounded by nature. Whether these vacationers know it or not, they’re improving their mental health, as a growing body of evidence shows green spaces can dramatically improve a person’s sense of wellbeing. But how? A new study may have the answer.

Published in the Proceedings of the National Academy of Sciences, the study found that nature walks reduce a person’s chances of ruminating, which in turn lessens their chances of developing depression and other mental illnesses. People who ruminate mull over particular issues in their life continuously, regardless of how much power they have over them, according to the American Psychological Association. Most of the time, these issues are also negative.

Over time, rumination can cause a downward spiral of negative thinking, which in turn impairs thinking and problem-solving, and may even lead to the loss of social support — once friends have become frustrated with the lack of an improved outlook on life. With everything that happens in a city, it’s easy to see how someone can get caught up in the negative thoughts that accompany their stress. This is why spending time in nature is all the more important.

“It’s really the blink of an eye that we’ve been living in urban areas. It’s not what we’re evolutionarily adapted to do,” Greg Bratman, a PhD candidate in conservation biology and lead author of the study, told Healthline.

For their study, the Stanford University researchers had 38 men and women fill out questionnaires that asked about their tendencies to ruminate. Then, they underwent brain scans to measure activity in a part of their brains associated with "self-focused behavioral withdrawal" — rumination — called the subgenual prefrontal cortex (sgPFC). Once done, they were told to either go on a 90-minute walk in a nature setting or an urban one. The results: Those who took part in the nature walk reported ruminating less often during their walk, and subsequent brain scans showed the sgPFC was less active as well.

“This study reveals a pathway by which nature experience may improve mental wellbeing, and suggests that accessible natural areas within urban contexts may be a critical resource for mental health in our rapidly urbanizing world,” the researchers wrote, noting that more than 50 percent of people now live in urban areas. By 2050, that percentage is expected to grow to 70 percent.

The World Health Organization estimates as many as 350 million people across the world live with depression. Though only a fraction of these people live in urban areas, adding more public green spaces may help lower depression rates. Many cities in the United States, such as Chicago and New York City, have already begun. "It's important to incorporate these 'psychological ecosystem services' into urban design, to help bring nature to the city, and to improve easy access to these landscapes and nature experience,” Bratman told the Huffington Post.

“We’re in a unique moment in human history,” he said. “Never before have so many people lived in cities, and never before have people been so disconnected with the natural world.”

Source: Bratman G, Hamilton JP, Hahn K, Daily G, Gross J. Nature experience reduces rumination and subgenual prefrontal cortex activation. PNAS. 2015.