Exposure to dirt may be a way to lift mood as well as boost the immune system, UK scientists say.
Lung cancer patients treated with "friendly" bacteria normally found in the soil have anecdotally reported improvements in their quality of life.
Mice exposed to the same bacteria made more of the brain's "happy" chemical serotonin, the Bristol University authors told the journal Neuroscience.
Common antidepressants work by boosting this brain chemical.
A lack of serotonin is linked with depression in people.
The scientists say more work is now needed to determine if the bacterium Mycobacterium vaccae has antidepressant properties through activation of serotonin neurons.
Lead researcher Dr Chris Lowry said: "These studies help us understand how the body communicates with the brain and why a healthy immune system is important for maintaining mental health.
"They also leave us wondering if we shouldn't all spend more time playing in the dirt."
The work could also help experts' understanding of why an imbalance in the immune system leaves some individuals vulnerable to mood disorders like depression, he added.