A new study suggests that both high-fat and high-sugar diets, compared to a normal diet, cause changes in gut bacteria that appear related to a significant loss of “cognitive flexibility,” or the power to adapt and adjust to changing situations.

This effect was most serious on a high-sugar diet, which also showed an impairment of early learning for both long-term and short-term memory.

The findings are consistent with some other studies about the impact of fat and sugar on cognitive function and behavior, and suggest that some of these problems may be linked to changes in the microbiome—a complex mixture in the digestive system of some 100 trillion microorganisms.

Researchers from Oregon State University studied laboratory mice that consumed different diets and then underwent a variety of tests, such as water-maze testing, to monitor changes in their mental and physical function, and associated impacts on various types of bacteria. The findings were published in the journal Neuroscience, in work supported by the Microbiology Foundation and the National Science Foundation.

“It’s increasingly clear that our gut bacteria, or microbiota, can communicate with the human brain,” says Kathy Magnusson, a professor in the Oregon State University College of Veterinary Medicine and principal investigator with the Linus Pauling Institute.

“Bacteria can release compounds that act as neurotransmitters, stimulate sensory nerves or the immune system, and affect a wide range of biological functions,” Magnusson says. “We’re not sure just what messages are being sent, but we are tracking down the pathways and the effects.”

Mice have proven to be a particularly good model for studies relevant to humans, particularly for issues related to aging, spatial memory and obesity.

In this study, after just four weeks on a high-fat or a high-sugar diet, the performance of mice on various tests of mental and physical function began to drop, compared to animals on a normal diet. One of the most pronounced changes was in what researchers call cognitive flexibility.

“The impairment of cognitive flexibility in this study was pretty strong,” Magnusson says. “Think about driving home on a route that’s very familiar to you, something you’re used to doing. Then one day that road is closed and you suddenly have to find a new way home.”

A person with high levels of cognitive flexibility would immediately adapt to the change, determine the next best route home, and remember to use the same route the following morning, all with little problem. With impaired flexibility, it might be a long, slow and stressful way home.

This study was done with young animals, which ordinarily would have healthier biological systems that are better able to resist pathological influences from their microbiota. Researchers believe the findings might be even more pronounced with older animals or humans with compromised intestinal systems.

Foods that are high in fat, sugars and simple carbohydrates—a combinations that's often referred to as the “Western diet”—have been linked to a range of chronic illnesses in the United States, including the obesity epidemic and an increased incidence of Alzheimer’s disease.

“We’ve known for a while that too much fat and sugar are not good for you,” Magnusson says. “This work suggests that fat and sugar are altering your healthy bacterial systems, and that’s one of the reasons those foods aren’t good for you. It’s not just the food that could be influencing your brain, but an interaction between the food and microbial changes.”