City-dwelling kids attend art exhibits and visit museums. They swing through the urban jungle on their way to corner groceries. They play in square parks with their parents and friends.

Children raised in the country romp through fields of hay and flowers. They frolic alongside pets and farm animals. They make mud pies and stomp in puddles.

In turn, new research suggests, these country kids may grow up with a more resilient immune system and a lower risk of mental illness than their pet-free urban-dwelling counterparts.

These findings come from a new study co-authored by researchers at the University of Ulm in Germany and the University of Colorado Boulder.

Previous research established that children exposed to animals and rural environments have a reduced risk of developing asthma and allergies later in life. The exposure to dust and allergens likely hardens their immune systems from an early age and provides protections throughout life.

With their study’s findings, which were published in the Proceedings of the National Academy of Sciences, these researchers are the first to show that exposure to bacteria and allergens might have protective benefits for mental health as well.

“This study moves the conversation forward by showing for the first time in humans that these same exposures are likely to be important for mental health,” Christopher Lowry, PhD, a study co-author and professor of integrative physiology at the University of Colorado Boulder, told CU Boulder Today.

How the study was conducted

For their research, investigators recruited 40 healthy German men between the ages of 20 and 40.

Half of these men grew up in large cities without pets. The other half grew up on a farm with animals.

Each man was assigned two tasks meant to elicit stress.

First, they were asked to give a speech about why they would be a good candidate for a dream job in front of an audience of stone-faced observers.

Then, they were asked to perform a math task and count down from an odd number by an odd number while being timed.

Researchers collected blood and saliva samples five minutes before the men started these tasks. They then collected samples 5, 15, 60, 90, and 120 minutes after the tasks were completed.

Each sample was measured for stress markers and signs of inflammation.

The city men had a “pronounced increase” in peripheral blood mononuclear cells (PBMCs), a significant component of the immune system.

Likewise, their levels of interleukin 6 (IL-6), an inflammatory compound, were elevated. Levels of interleukin 10 (IL-10), an anti-inflammatory compound, were suppressed.

Levels of cortisol — the “fight or flight” hormone — spiked higher in the country men. They also self-reported higher levels of anxiety following the tests than their urban counterparts.

However, while the city men self-reported feeling less stressed, their bodies launched into a high-stress mode more quickly and stayed stressed longer then the rural men.

Additionally, the levels of stress hormones in the rural men began to wane quickly. Decreases were seen as soon as five minutes after the tests were completed.

“People who grew up in an urban environment had a much-exaggerated induction of the inflammatory immune response to the stressor, and it persisted throughout the two-hour period,” Lowry said.

These findings add another notch on the wall for the “hygiene hypothesis.”

This theory contends that overly sterile environments might actually cause more health problems than they prevent.

Indeed, previous studies have shown that individuals with an exaggerated inflammatory response, such as what was seen in the men raised in urban settings in this study, are more likely to develop mental health issues, including depression and post-traumatic stress disorder (PTSD) later in life.

The hair-trigger response to stress seen in the urban dwellers may be an indication of future issues.

Children raised in rural settings, such as farms, may be less likely to develop these mental health issues precisely because their body doesn’t have the prolonged high-stress and inflammatory response seen in city kids.

The exposure to greater quantities of bacteria may protect their immune systems and mental health against a wider range of possible problems than previously thought.

That's not to say there aren't health issues in rural areas.

People living in rural towns have higher risks of heart disease, cancer, respiratory disease, and stroke. Much of that risk is from lifestyle choices such as smoking and poor diet.

There are also shortages of medical services. These include the closing of hospitals and the declining number of maternity services.

Nonetheless, researchers point out the potential for a healthier life is there in rural areas.

The growing urbanization crisis

These findings could have long-term implications for the global healthcare system.

Since 1950, urban populations across the world have grown rapidly.

In 1950, 746 million people lived in urban settings. In 2014, 3.9 billion people were living in cities, more than those who lived in all rural areas combined.

Today, more than 54 percent of the world’s population lives in urban environments and the disparities between the two locales continue to worsen.

That means that greater numbers of individuals will grow up with a lack of bacterial and microorganism exposure. This could, according to this study, set up a greater population for future health issues.

When individuals aren’t exposed to environments that challenge and strengthen their immune systems, their bodies don’t learn to balance the inflammatory and anti-inflammatory forces.

This sets up a chronic inflammatory cycle that this study, as well as previous studies, shows leads to potential allergy, autoimmune, and now psychiatric disorders.

Advice to city dwellers

You need not pick up your life and head for the nearest alpaca farm to help strengthen your immune system and create a healthier life for your child — at least not yet.

The researchers for this study say they need to expand their investigations, use larger sample sizes, include women, and scout new locations before they can declare that urban life is a hazard to mental health.

For now, their advice is to eat foods that contain good bacteria, such as probiotic-rich kombucha, spend more time in any bit of nature you can access, and yes, even get a pet.

“There are many advantages to having a pet,” says Dr. Mason Turner, a psychiatrist with Kaiser Permanente. “Studies show that they can ease stress and help lower blood pressure and inspire feelings of happiness. This human-animal interaction increases our levels of oxytocin, known as a hormone associated with caretaking and positive feelings in the brain.”

Turner adds that having a pet also decreases cholesterol and triglyceride levels, which boost blood flow.

As a two-for-one win, Turner says pets can encourage you to get outside more, which also boosts your exposure to bacteria-laden dust and microorganisms you don’t find inside.

“Another bonus to having a pet is that they can get children outdoors and moving,” he told Healthline. “For example, taking a dog for a walk or playing with a pet in the backyard can improve their health by lowering their risk of obesity.”

Children aren’t the only ones who can get a waistline benefit from having a furry friend, either.

“Owning a pet like a dog can help adults increase their opportunity to exercise. For example, walking and doing some outdoor activities, which can lower the risk of obesity,” Turner says.