Urinary tract infections and stomach bugs are no fun, but they may actually curb the risk of developing rheumatoid arthritis.

No one likes being sick — especially with something as uncomfortable as a urinary tract infection or a stomach bug.

However, these infections could help curb the risk of rheumatoid arthritis (RA), a serious autoimmune illness.

Read More: 10 Little-Known Facts About Your Immune System »

Research published in Annals of the Rheumatic Diseases shows a link between these types of infections and the incidence of rheumatoid arthritis.

The researchers who conducted the study wanted to see the impact that various infections have on the risk of RA.

They studied 6,500 people in Sweden. Of those, 2,831 were diagnosed with RA between 1996 and 2009, while the remainder did not have the disease and were generally healthy.

The average age of the participants was 52. Seven out of 10 were women.

Study participants who specifically had gut, urinary tract, or genital infections during the preceding two years showed a decreased risk of developing RA.

The risk was reduced by 29 percent for those with gut infections, 22 percent for those with urinary tract infections, and 20 percent for those with genital infections. Those who had all three infections saw their RA risk shrink by 50 percent.

Those who had other types of infections showed no decreased or increased RA risk. Researchers took smoking behavior and socioeconomic background into account.

Read More: Could Balancing Gut Bacteria Be the Key to Unlocking RA? »

While doctors can’t draw concrete conclusions from the study yet, researchers are hopeful it will lead to further exploration of the link between infections and RA. It may even provide proof that the gut microbiome — the bacteria and other bugs that naturally live in the human gut — plays an important role in the RA disease process.

One potential explanation for the finding is that these specific bacterial infections alter the natural balance of bacterial species in the body. This can in turn affect the body’s inflammatory immune response. 

“The results indicate that infections in general do not affect the risk for RA, but that certain infections, hypothetically associated with changes in the gut microbiome, could diminish the risk,” said the authors in a written statement regarding the study.

It wouldn’t be the first time doctors or researchers thought there was a link between infection and RA. In fact, antibiotics, while not considered a first line of defense in the treatment and management of rheumatoid arthritis, have been effective for a select few. Some RA patients still see infectious disease doctors or gastroenterologists in addition to their rheumatologists.

So, if you do have an all-too-common urinary tract infection, try to find the silver lining. It might be helping you to stay RA-free.

Read More: NSAIDS Relieve Arthritis Pain, But Are Tougher on the Tummy than Celebrex »