Fido the dog and Ginger the cat need not worry about being replaced by a new baby — in fact, they could be helping parents raise healthier children.

A new study finds that children who lived with dogs or cats during their first year of life got sick less frequently than kids from pet-free zones. The study, published in Monday’s edition of the journal Pediatrics, provides fresh evidence for the counterintuitive notion that an overly clean environment may not be ideal for babies.

Sharing a home with a pet may be an early form of cross-training for the body’s defense systems. Previous research has shown that owning a cat or dog was associated with less risk of gastroenteritis in young children.

Studies also suggest that the dirt — and microbes — brought indoors by pets could bolster the communities of helpful bacteria, yeast and other microscopic creatures that live in a developing child’s body.

For instance, a paper presented last month at a meeting of the American Society for Microbiology showed that mice fed dust from homes with dogs were less likely than other mice to contract respiratory syncytial virus, which is thought to play a role in the development of childhood asthma. In addition, the composition of microbes in their guts was significantly different from that of mice that were not exposed to doggy dust.

For the new study, European researchers tracked the health of 397 Finnish children born between September 2002 and May 2005. When the infants were 9 weeks old, parents began keeping weekly diaries to document a number of indicators of their children’s health, including runny noses, coughs and ear infections. Parents also noted when their babies were given antibiotics. When the children celebrated their first birthdays, the parents were asked to complete a questionnaire.

Overall, the researchers found that cats and dogs were linked to a reduced incidence of various types of illness. The effect was stronger for dogs than for cats: Babies who lived with dogs were 31% more likely to be in good health than their counterparts who didn’t, and babies with cats had a 6% advantage over those without feline family members.

The children with pet dogs were 44% less likely to develop ear infections and 29% less likely to have used antibiotics during their first year, the report said.

Here’s where the plot thickened: Although living with a cat or dog was correlated with good health, the benefit was biggest when those pets weren’t around the house very much.

In cat-owning households, babies whose cats were indoors more than 16 hours a day were healthy 70.8% of the time. But in homes where the cat was inside for less than six hours a day, babies were healthy 78.2% of the time. For the sake of comparison, young children who lived in cat-free zones were healthy 66.1% of the time.

A similar pattern held for dogs: Kids with homebody canines were healthy 72.2% of the time, and that figure rose to 75.7% for children whose dogs spent fewer than six hours indoors each day. In dogless households, babies were healthy 64.8% of the time.

The researchers offered a possible explanation for the puzzling pattern: Pets that spent more time outdoors brought more dirt into their homes, giving babies more opportunities to encounter it. That exposure could have caused their immune systems to mature faster than they would have otherwise, they wrote.

Until now, studies on the ways pets influence human health have largely focused on allergies, not illness, said Dr. Danelle Fisher, vice chair of pediatrics atSt. John’s Health Center in Santa Monica, who wasn’t involved in the study.

“It’s more support in a growing body of evidence that exposure to pets early in life can stimulate the immune system to do a better job of fighting off infection,” Fisher said.

The new findings could help assuage parents-to-be who worry about the health consequences of exposing their infant to a pet.

“What I always tell them is this: It’s actually very helpful to have a cat or dog around because we tend to see less allergies,” Fisher said. “And now I can tell them we’ve even seen less chance of upper respiratory infection in the first year of life.”

amina.khan@latimes.com