Counterintuitive as it seems, research has found the less sterile a place we grow up in as children, the more protection we may have against developing allergies such as asthma. Less certain though is why.

According to a new study published Thursday in Science, part of the reason may involve a complex interplay between our genes and the microbes that live alongside us.

Exposing mice to low doses of endotoxin, a common component of gram-negative bacteria, for a two-week period, the researchers noticed that they were much less likely to develop “canonical asthma features” when in the presence of house dust mites, compared to a control group. The authors believed that this happened because the endotoxin reduced the “overall reactivity of the immune system,” which in turn prevents the body from turning against itself and developing an autoimmune response to common stimuli like certain foods and dust mites.

When the researchers took a closer look, they found that this protective effect was only seen in mice whose genes possessed the ability to produce an anti-inflammatory enzyme, A20, in their lungs. In mice who didn’t, the endotoxin effect disappeared.

As further evidence, when the researchers conducted the same type of experiment with human lung cells, taken from both healthy and asthmatic individuals, they found that the healthy cells, with higher A20 levels, produced less of an inflammatory response commonly linked to allergies than did asthmatic cells, which had low A20. And the authors noted that other research has found a correlation between farm-dwelling people who possess a mutated A20 gene and higher allergy rates.

Environments like dairy farms, filled with livestock, and pet-owning homes are known to harbor levels of endotoxin in the air, along with other microbial debris. That debris can cause people trouble in high enough doses, but in low doses, it appears to calibrate our immune systems to better tell apart dangerous foreign substances from their harmless counterparts, as long as we have the right genetic machinery, such as the A20 enzyme.

The study’s findings suggest that one way to target allergies in the future may require tweaking that machinery.

Source: Schuijs M, Willart M, Vergote K, et al. Farm dust and endotoxin protect against allergy through A20 induction in lung epithelial cells. Science. 2015.