Circumcision reduces a man’s risk of acquiring and transmitting H.I.V. and other sexually transmitted diseases, and now researchers have found a possible explanation: the procedure reduces the quantity and diversity of bacteria at the head of the penis.

Researchers in Uganda studied 79 men randomly assigned to circumcision and 77 who remained uncircumcised, controlling for age, number of sexual partners and other factors. The study is in the March/April issue of the journal mBio.

After a year, the bacterial load had decreased in both groups, possibly because being in a study spurred behavior changes. But the decrease was significantly larger in those who were circumcised. Diversity of bacteria also decreased more in the circumcised men than in the uncircumcised, and almost all of the bacteria that decreased were anaerobic — the kind that do not survive when exposed to oxygen at the exposed tip of the penis.

“We’re not trying to prove that everyone should be circumcised,” said the senior author, Lance B. Price, a professor of occupational and environmental health at George Washington University. “We’re trying to understand how it works and, by understanding, possibly establish alternative strategies to reduce people’s risk for H.I.V.”

The effect of bacteria in H.I.V. acquisition is unknown, but bacteria may play a role in attracting T-cells, the immune system cells that the virus attacks, or cause inflammation that makes transmission more likely.