People who struggle to maintain a healthy weight after dieting may do so because their gut bacteria retains a “memory” of their past weight, according to scientists.

The study, in mice, suggests that yo-yo dieting is not simply a reflection of people returning to unhealthy eating habits, but could be driven by long-term changes in gut bacteria brought about by obesity.

The scientists observed that the changes to the gut microbiome brought about by obesity persisted for five times as long as the actual period spent dieting and predisposed the mice to rapidly regain weight.

Eran Elinav, an immunologist at the Weizmann Institute in Israel and lead author, said that the findings, if replicated in people, could help develop more evidence-based methods for weight loss. “It may explain some – more than some – of our failure to control weight by dieting,” he said.

Simon Cork, a medical researcher at Imperial College London, said the study was one of the first to show that gut bacteria could actively drive weight gain, rather than simply being associated with it. However, he cautioned that it was unclear whether the findings could be extrapolated to people.

“We do know that this yo-yo effect is caused by quite a few different mechanisms and it’s likely that gut bacteria is only going to play a small role,” he said. “Ultimately, the main reason why people yo-yo is because they don’t stick to the diet.”

In the study, published in Nature, obese mice were switched from a high fat diet to balanced nutrition until they were indistinguishable from a control group of mice in terms of weight and a range of metabolic factors, such as blood sugar levels.

However, the scientists found that the formerly obese mice retained differences in their gut bacteria after dieting that tended to increase the rate at which they put on weight once they were given access to high fat food. When the guts of the control mice were seeded with bacteria from the obese group they too put on weight more rapidly.

The scientists suggest that the mechanism may have evolved to act as a physiological “buffer” against weight loss in times of food scarcity.

However, in the case of obesity, the mechanism may work against the person by leaving them liable to put weight back on rapidly once they stop dieting.

In mice, the microbiome slowly shifted back towards the mix of bacteria seen in the control group over a period of six months (about a quarter of the lifespan of a mouse in captivity). In humans, the scientists predicted, the equivalent period could be anything from months to years. “I know this is a sobering thought,” said Elinav.

However, he added that if the human microbiome undergoes similar changes, it might be possible to target this to help people maintain a healthy weight after dieting. “Once you get rid of the differences in the microbiome then you close this window of risk,” he said.

Cork said that the composition of gut bacteria is notoriously difficult to shift, however, and that any treatment would involve a long course of antibiotics to eradicate the existing population of microbes, rather than being a case of eating “a few probiotic yoghurts”. “If you try to introduce something else in a small quantity the bacteria in your gut out-competes them,” he said.

The study also showed that the rate at which individual mice put on weight could be predicted by based on the composition of their microbiome.

The scientists did not fully investigate how the changes to the microbiome influenced weight gain, but said that the data suggested there was a change in metabolism, that meant the gut bacteria were converting more energy into fat.

Previous research suggests that when people who have long-term obesity lose weight through dieting, in up to 80% of cases they put weight back on again within 12 months.