A team of researchers from the University of California San Diego (UCSD) School of Medicine has discovered that people who suffer the most from migraines have higher concentrations of microbes that change the nitrates from various foods into chemicals that induce migraines.

Their work that, published in mSystems on Oct. 18, 2016, shows that foods like chocolate, wine, some green vegetables and processed meats have chemicals called nitrates that consist of a nitrogen atom in addition to three oxygen atoms.

Bacteria in the human guts and mouth disintegrate these nitrates to use for fuel. During this process, they eradicate one of the oxygen atoms from the compound, which results in a byproduct referred to as a nitrite. The nitrite then makes its way through the bloodstream and gets transformed into nitric oxide that has been associated with migraines and different types of headaches.

Read: Wine Secret Unlocked: Study Reveals Reason Behind Old Wines' Enticing Aroma

Researchers from UCSD studied microbial DNA gathered in the American Gut Project. They analyzed 1,996 fecal samples and 172 oral samples and came to the conclusion that those who get migraines have comparatively a larger amount of bacteria both in their guts and mouths that are capable of creating nitrites from nitrates than those who don't get the headaches.

The team, however, said that it's still unclear whether the difference in the quantity of bacteria is the reason for the migraine, or if there's an indirect connection. Antonio González Peña, team leader and scientist at UCSD stated that his research group will now study those patients with different kinds of migraines, such as retinal and aura, to find out a certain species of bacteria for the reason behind this common illness. The objective behind the study is to eradicate migraines without posing any dangers to the heart, Antonio said in a statement.