It can begin with abdominal pressure from a bloating belly. This can escalate into cramping pain and nausea. Or, a sudden urge to flee to the toilet right now.

These uncomfortable, disruptive and, at times, embarrassing symptoms are all too familiar for up to one in five people who, like me, have misbehaving gastrointestinal systems.

Conditions like irritable bowel syndrome (IBS) are more common in women. Their triggers can include poor sleep, stress, or simply eating the wrong, seemingly benign food. You can eat what would be, by every other measure, an extremely healthy meal and end up feeling like you've just been food poisoned.

Until my diagnosis, I would never have thought something as innocuous as an apple could cause such a dramatic bodily reaction as explosive diarrhoea.

While carefully maintaining a low FODMAP diet has provided me and many others with some desperately needed relief and control over our symptoms, the physiological mechanism behind our suffering has remained a mystery. This can make receiving a clear and timely diagnosis challenging.

"Very often these patients are not taken seriously by physicians, and the lack of an allergic response is used as an argument that this is all in the mind, and that they don't have a problem with their gut physiology," said Katholieke Universiteit Leuven gastroenterologist Guy Boeckxstaens, whose team of more than 40 researchers, led by neuroimmunologist Javier Aguilera-Lizarraga, have just identified a biological mechanism behind IBS.

"With these new insights, we provide further evidence that we are dealing with a real disease."

Clinical studies have suggested gut infections from pathogens like Escherichia coli, and Salmonella can increase the likelihood of someone developing IBS and patients often describe their symptoms commencing after a case of food poisoning. This gave the researchers a hunch.

So, they infected laboratory mice with bacteria (Citrobacter rodentium) that cause food poisoning, while also feeding them a protein found in eggs (ovalbumin). Once the mice recovered from the infection, feeding them ovalbumin alone activated intestine immune cells, whereas these cells didn't react in control mice that had been given ovalbumin but not the bacteria.

The egg protein was now being recognised as an antigen (a foreign invading substance) by the non-control mice's immune system.

Normally, our immune system turns a blind eye to the bits of proteins (which can be recognised as antigens by our immune system) we digest, a process called oral tolerance. But it appears that when the immune system activates in response to an infection, it also learns to see the food present at the time as a threat as well – producing antibodies to recognise and remember these antigens.

When the antibodies then run into the antigen again (in this case the egg protein) they hold onto it and bind with mast cells, triggering these immune cells to release histamines and their inflammatory processes.

Histamines are known to make neurons extra sensitive – explaining the abdominal pain even when the intestinal tissue is only stretched within normal limits during food digestion.

Mice, genetically engineered to lack mast cells, did not display the same pain response, confirming the involvement of these cells.

Aguilera-Lizarraga and colleagues then tested 12 IBS patients and 8 healthy people to see if their intestines reacted the same way as the mice's. Sure enough, injecting known food triggers like soy and cow's milk into the IBS patients' intestinal wall caused a similar localised immune response, but not in the healthy volunteers.

In both mice and humans the immune response was restricted to the intestines – specifically to the mouse colon where the bacterial infection had taken place – clearly distinguishing this food intolerance from food allergies, such as gluten allergies, which cause body-wide immune system activation.

"The idea that you can have a specific allergic response going on in the gut [is] a really new concept," University of Nottingham gastroenterologist, who was not involved in the study, told Science.

While this study is only small, earlier clinical trials have shown treatment with antihistamines can improve IBS symptoms, supporting the idea that mast cell activation is a key culprit. And other similar gastrointestinal conditions have also implicated bacteria in their cause.

"Mast cells release many more compounds and mediators than just histamine," explained Boeckxstaens. "So if you can block the activation of these cells, I believe you will have a much more efficient therapy."

The researchers are now exploring if stress-induced IBS involves the same underlying mechanisms, and more work on the use of antihistamines to treat IBS is currently underway.

Although learning why my guts are so disagreeable is incredibly fascinating, I for one am busting for treatments that might no longer have me scrambling for the toilet just because I've eaten foods with onion and garlic.

This study was published in Nature.