Couch potatoes beware: Physical fitness during middle age may be a driver of brain health later in life, according to the results of a new study.

In a research project spanning two decades, scientists have found that the participants who were less fit at age 40 had a greater degree of brain shrinkage 20 years later compared to those who were in better shape.

The brain shrinkage was small but significant enough to raise the participants' risk of memory loss and dementia, the researchers said. The study appears today (Feb. 10) in the journal Neurology.

The research tapped into data from the Framingham Heart Study, an ongoing program that has followed the lives of thousands of ordinary people over the course of nearly 70 years and three generations. [6 Foods That Are Good For Your Brain]

Researchers led by Nicole Spartano, a postdoctoral fellow at Boston University School of Medicine, looked at data from approximately 1,100 Framingham participants who underwent a vigorous treadmill test and MRI scan when they were about 40 years old. The participants did not have heart disease or dementia. These same participants did a similar treadmill test and MRI scan 20 years later.

The treadmill test provided information about their physical fitness and heart health because it measured how long they could stay on the treadmill before their heart rate reached 85 percent of their estimated maximum heart rate. The time spent on the treadmill was used to estimate VO2 max, the maximum amount of oxygen one's body can use in one minute.

An average, healthy person typically has a peak VO2 of about 30 to 40 mL/kg/min (milliliters of oxygen per kilogram body weight per minute). Elite athletes can have twice this rate.

The researchers also measured the participants' blood pressure and the amount that their heart rate increased during the exercise. Participants with lower estimated VO2 max, higher blood pressure or greater increase in heart rate during exercise as 40-year-olds all had greater brain shrinkage 20 years later.

Story continues

Participants had one year of accelerated brain aging for each 8 mL/kg/min lower estimated VO2 max, 17 beats per minute higher heart rate or 14 mm Hg higher diastolic blood pressure during exercise, Spartano said.

"If you think about each of these factors having an effect on your brain health, then the effects can really start to add up," Spartano told Live Science. The effect was not huge, but was still seen after the researchers adjusted for other factors that may affect brain health, such as high blood pressure, smoking and diabetes, she said.

So, what exactly is shrinking?

"Atrophy correlates with fewer [brain] cells and less rich synaptic connections," said Dr. Sudha Seshadri, a professor at Boston University School of Medicine and senior author on the report. She added that the study — which had the benefit of tracking so many people for so long in a well-controlled setting — should drive home the message that midlife physical fitness, if not lifelong fitness, affects brain health later on.

Previous studies have shown that physical exercise among the elderly reduces the risk of memory loss and dementia.

The new study "emphasizes the need to encourage exercise in midlife to promote healthy cognitive aging and reduce brain atrophy, though correlating the results with cognitive assessment would also provide further insight on this relationship," said Dr. Jennifer Molano, an expert on cognitive disorders at the University of Cincinnati College of Medicine, who was not involved in this research.

Follow Christopher Wanjek @wanjek for daily tweets on health and science with a humorous edge. Wanjek is the author of "Food at Work" and "Bad Medicine." His column, Bad Medicine, appears regularly on Live Science.

Copyright 2016 LiveScience, a Purch company. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.