Gardens are good for your brain—and bacteria may be the reason why, according to a University of Arizona researcher.

“Dirt has a lot of microbes in it—a lot of little bacteria and such—that we know impact the immune system in ways that actually enhance emotional resilience,” says Dr. Charles Raison, an associate professor of psychiatry in the University of Arizona College of Medicine and the College of Agriculture and Life Sciences.

Raison is one of few researchers in the U.S. and internationally who are studying the mental health benefits of natural landscapes.

Their physical benefits have been known for decades.

“It’s been shown a number of times now that people who live near green spaces, who have access to natural environments, live longer than people who don’t,” Raison says.

An often-cited 1984 study by environmental psychologist Roger Ulrich in the journal Science showed that hospital patients who had a view of trees and other green spaces outside their windows healed more quickly and with fewer complications than patients who faced only a brick wall.

But more recent studies indicate that nature can heal the mind too.

“There are now a number of studies to suggest that gardening in particular—therapeutic garden—may beneficially impact a range of conditions: obesity, dementia, schizophrenia, depression,” Raison says.

As more and more health care providers and treatment facilities turn to gardens to help people heal, researchers are probing deeper into why gardens work. They think bugs may be part of the answer.

Scientists have found that contact with a bacterium that lives in the soil, Mycobacterium vaccae, can improve cognitive function and mood.

“What’s remarkable is that this microorganism seems to know how exactly to signal the brain areas we believe are most important for reducing depressive symptoms,” says Raison. “It’s like it immediately goes on a mainline right up to this one particular area of the brain.”

So far, most studies of M. vaccae have been done in animals, but Raison is hopeful that future studies in humans could yield a new tool for fighting depression and other mood disorders.