Low muscle mass and high belly fat are linked with a decline in the ability to reason and think flexibly.

That’s according to recent research from Iowa State University, which linked greater midsection fat to worsened fluid intelligence as people aged. Greater muscle mass, by contrast, appeared to protect flexible reasoning over time. Socioeconomic status and education level had no effect on the link.

“Chronological age doesn’t seem to be a factor in fluid intelligence decreasing over time,” said Auriel Willette, Ph.D., who led the study. “It appears to be biological age, which here is the amount of fat and muscle.”

The takeaway? People may want to fight the natural tendency to gain fat and lose lean muscle after middle age, said neuroscientist Brandon Klinedinst. Exercising, especially resistance training, is essential for women, who naturally tend to have less muscle mass than men, he added.

The researchers also found some evidence that the immune system plays a role in this link between fat, muscle and fluid intelligence. Previous studies have shown that people with a higher body mass index have more immune system activity in their blood, which in turn may affect cognitive abilities.

The study was published in the journal Brain, Behavior and Immunity.