Promising trials hinted that circumcision could lower rates of HIV infection, but until now, researchers didn’t fully understand why.

Now, in a study published in the journal mBio, scientists say that changes in the population of bacteria living on and around the penis may be partly responsible.

Relying on the latest technology that make sequencing the genes of organisms faster and more accessibleLance Price of the Translational Genomics Research institute (TGen) and his colleagues conducted a detailed genetic analysis of the microbial inhabitants of the penis among a group of Ugandan men who provided samples before circumcision and again a year later.

While the men showed similar communities of microbes before the operation, 12 months later, the circumcised men harbored dramatically fewer bacteria that survive in low oxygen conditions. They also had 81% less bacteria overall compared to the uncircumcised men, and that could have a dramatic effect on the men’s ability to fight off infections like HIV, says Price. Previous studies showed that circumcised men lowered their risk of transmitting HIV by as much as 50%, making the operation an important tool in preventing infection with the virus. Why? A high burden of bacteria could disrupt the ability of specialized immune cells known as Langerhans cells to activate immune defenses. Normally, Langerhans are responsible for grabbing invading microbes like bacteria or viruses and presenting them to immune cells for training, to prime the body to recognize and react against the pathogens. But when the bacterial load increases, as it does in the uncircumcised penile environment, inflammatory reactions increase and these cells actually start to infect healthy cells with the offending microbe rather than merely present them.