People who take popular heartburn pills known as proton pump inhibitors (PPIs) may be more likely to develop intestinal infections than people who don’t take these medications, a Scottish study suggests.

The pills work by stopping cells in the stomach lining from producing too much of the acid that can cause ulcers and reflux symptoms such as heartburn.

Researchers examined data on about 188,000 people who used these drugs and about 377,000 similar individuals who didn’t take PPIs. Compared to people who didn’t use the drugs, those who did were at higher risk for a severe form of diarrhea caused by the Clostridium difficile bacteria. Their odds of this infection were 1.4 times higher when they were hospitalized and 1.7 times higher when they weren’t in the hospital.

In addition, PPI users had a 4.5 times greater risk of getting Campylobacter infections, a common form of food poisoning, if they were hospitalized and a 3.7 times higher risk when they weren’t hospitalized.

“Reducing stomach acid, which acts as a barrier to infection, increases the chance of getting a GI infection,” said senior study author Dr. Thomas MacDonald, a pharmacology researcher at the University of Dundee in Scotland.

“The main risk of PPIs are gastrointestinal infections,” MacDonald added by email.

MacDonald and colleagues analyzed data on stool samples collected from patients in Scotland between 1999 and 2013.

Overall, there were 22,705 positive test results for bacterial infections. This included 15,273 people with C. difficile and 6,590 cases of Campylobacter, the authors reported in the British Journal of Clinical Pharmacology.

Researchers also tested for Salmonella, Shigella and Escherichia coli, or E. coli, but didn’t find an association between PPIs and these infections.

One limitation of the study is that it only included data on people who took PPIs with a prescription, even though these drugs have been available in Scotland since 2004 without a prescription, the authors note. Researchers also lacked data on other factors that can influence the risk of bacterial infections such as obesity, smoking and alcohol use.

Previous research on PPIs and infections has produced mixed results, with some studies suggesting an association and others failing to establish a connection, noted Dr. Wojciech Marlicz, a gastroenterology researcher at Pomeranian Medical University in Poland who wasn’t involved in the study.

Millions of people worldwide take PPIs, which are available without a prescription in Europe and the U.S., which means even a slight increase in the odds of bacterial infections can still impact a lot of patients.

“The main problem with PPI use is their general overuse,” Marlicz said by email. “These drugs are very potent and safe when used according to indication.”

“Some patients will gain clear benefits from PPIs as they have stomach problems, such as ulcers which will heal better with less acid,” said Dr. Claire Steves, a researcher at King’s College London who wasn’t involved in the study.

“However other patients may take these as preventatives, or for mild symptoms,” Steves added by email. “This study would prompt us to reassess the risk and benefit for each individual, and in some cases alternatives – such as changing diet or lifestyle – may be better options.”