People living in deprived communities are less likely to use medication for depression and anxiety if they have easy access to well-maintained woodlands, the study found.
Researchers at the Universities of Edinburgh and Glasgow analysed data from more than 129,000 people over five years.
The study is one of the largest analyses of its kind, assessing how investments in local woodlands in and around towns in Scotland affect people's mental health.
Woodland areas
The researchers used NHS prescription records and census data to see whether people living within a 10-minute walk of an improved woodland area were more or less likely to be taking medication for depression or anxiety.
Woodland improvements had been supported through Scottish Forestry's Woods In and Around Towns (WIAT) initiative, which provided funding for practical improvements such as new footpaths, better signage, and community events.
Reducing barriers
The initiative prioritised areas that were more socially and financially disadvantaged, where woodlands required improved management to reduce barriers and enable more local people to use and enjoy them.
People living in urban deprived communities that were close to a woodland area that had been made more welcoming and easier for people to use were 10 per cent less likely to be prescribed antidepressants and six per cent less like to be prescribed anti-anxiety medication, than those living further away.
Mental health outcomes
This was the case even when accounting for other factors linked to mental health outcomes, such as demographics and poverty.
The benefit of living near these woodlands showed up for the same people even when their proximity to these woodlands changed. For example, when someone moved closer to an improved woodland, their need for medication went down.
By tracking the same individuals over time, the researchers say they can be more confident that it was the woodland improvements making the difference, rather than simply healthier or wealthier people happening to live in greener areas.