How your immune system does its job seems to depend more on your environment and the germs you encounter than on your genes, says new research that put twins to the test to find out.

After all, the immune system adapts throughout life to fight disease, said Stanford University immunologist Mark Davis, who led the work.

And while young children's immunity may be more influenced by what they inherit from mom and dad, Thursday's study showed genetic influences waned in adulthood.

"Experience counts more and more as you get older," said Davis, director of Stanford's Institute for Immunity, Transplantation and Infection.

Scientists know there is tremendous variation in how the immune systems of healthy people function. Davis asked if that's more a matter of nature or nurture, by comparing 78 pairs of twins with identical genetic makeups to 27 pairs of fraternal twins, who are no more alike genetically than any other siblings. Traits shared by the identical twins are more likely to be hereditary.

His team used blood samples from the twin pairs, who ranged in age from 8 to 82, to track more than 200 activities and components of the immune system. In three-quarters of the measurements, differences between pairs of twins were more likely due to non-heritable influences - such as previous infections or vaccinations, even nutrition - than genetics, the researchers reported in the journal Cell.

Then they compared the oldest twins, 60 and over, to those under age 20, when the immune system is still maturing. The youngest identical twins had far more immune similarity than the oldest. That makes sense, as older twins presumably haven't lived together in years and have had different exposures since childhood, they concluded.

When the researchers gave flu vaccine to participating twins, they found no sign that genetics determined how many flu-fighting antibodies were produced.

Most intriguing, the researchers found infection with a virus so common that most adults unknowingly carry it had a dramatic effect. Cytomegalovirus, or CMV, is dangerous to those with weak immune systems but harmless for most people, and prior research has shown it can rev up parts of a healthy immune system. Sure enough, the Stanford team examined 16 pairs of identical twins where only one had CMV, and found big differences in nearly 60 percent of the components studied.

Does that mean we should try to prime the immune system, rather than working so hard to avoid germy situations?

"I'm a strong believer in the power of dirt," Davis said with a laugh, but this study actually can't offer health advice.

"This just says the environment plays a huge role in shaping what your immune system looks like," he explained.

Investigating how that happens is important, said Dr. Megan Cooper, a pediatric immunologist and rheumatologist at Washington University School of Medicine in St. Louis, who wasn't involved in the study. She noted that autoimmune diseases tend to run in families but whether someone born genetically susceptible gets sick may be shaped by their exposures.

"It's when you get those infections" that may be key to the impact on the immune system, she said.