Probiotics are sold to us as 'good' bacteria that help balance out 'bad' varieties of microbes camping out in our gut. But a new experiment on mice has shown how our microbial allies can evolve into traitorous backstabbers that risk causing damage to our guts.

The news isn't all bad - we can use their propensity to change to build these gut bugs into better bacteria.

"If we're going to use living things as medicines, we need to recognise that they're going to adapt, and that means that what you put in your body is not necessarily what's going to be there even a couple hours later," says pathologist and biomedical engineer Gautam Dantas.

Unlike other forms of medication, living organisms literally have a life of their own. What you swallow can reproduce. And what can reproduce can change.

"There is no microbe out there that is immune to evolution," says Dantas.

Dantas led a team of researchers from the University of Washington who evaluated a bacterium marketed to help combat diarrhoea.

Just over 100 years ago, a German physician named Alfred Nissle found some strains of Escherichia coli could be used to treat patients who were suffering from infectious diseases.

One strain in particular still stands out for its talent in combating acute diarrhoea, especially in young children. E. coli Nissle 1917 (EcN) has been shown to be a safe and effective treatment for what can be a deadly condition.

To evaluate the potential of EcN's evolution after it's swallowed, the research team used mice specially bred to be completely germ free.

The test subjects were divided into four groups, each with a distinct gut microbiome. One was left completely sterile; the other three were given microbiomes reflecting various healthy and unhealthy states.

Each group was dosed with EcN and then fed one of the following options - boring old lab mouse chow, a more natural mouse-friendly diet, a Westernised diet high in fats and sugars, and a Westernised diet that had some fibre added.

Five weeks later, the mice had their guts examined. Those happy little E. coli? It turns out they weren't all quite as friendly as they had been on their way in, especially in guts that had to deal with less than healthy diets.

Inside mouse guts filled with westernised foods, EcN had accumulated mutations that helped them cope with stress and make use of all of those carbohydrates to hang around longer than intended.

These bacteria also adapted to become a little stickier, giving them a competitive edge over the other residents.

More concerning, the EcN inside a group of mice treated with streptomycin had evolved a low level of resistance to the antibiotic.

"In a healthy, high-diversity background we didn't capture a lot of adaptation, maybe because this is the background that Nissle is used to," says biomedical engineering graduate student Aura Ferreiro.

"But you have to remember that quite often we wouldn't be using probiotics in people with a healthy microbiome."

These tricks might have been great news for the probiotic E. coli trying to make a home inside their new environment, but for their host it poses significant concern.

Sticky bacterial cells that cope with stress by evolving easily to break down carbohydrates aren't what we sign up for with probiotics.

The results show that popular probiotics such as EcN aren't the kind of friendly guests we might want in our homes, but are opportunistic scavengers that will turn on us if we don't treat them with the right level of affection.

Before we furiously flush our germ pills, there's a few things to keep in mind.

This is a mouse study. As we all know, there's a leap of anatomy between these tiny mammals and humans. It's a good first step into research that might warrant investigation, but not an immediate cause for alarm.

There's also an intriguing epilogue to the study. The research team introduced a gene for degrading the amino-acid phenylalanine into their strain of E. coli and developed it into a probiotic.

Some people have a condition called phenylketonuria that stops them from adequately breaking down this protein building-block on their own, resulting in a build-up that can threaten brain damage.

Giving this probiotic to mice engineered with a similar condition temporarily helped them metabolise phenylalanine, lowering their levels by half. Similar studies by other researchers are already suggesting engineered probiotics are the future of medical treatments for a number of conditions.

The DNA of the engineered EcN also remained relatively stable over the week of treatment, suggesting common probiotics might benefit from a helping hand to turn them into tiny champions of gut health while retaining their loyalty.

"We can use the principles of evolution to design a better therapeutic that is carefully tailored to the people who need it. This is an opportunity, not a problem," says Dantas.

Probiotics clearly have a lot of potential for our health. We just need to learn how to keep them on our side.

This research was published in Cell Host & Microbe.