It’s not even close to being a secret that exercise can help prevent a bunch of diseases, from heart disease to some cancers. Studies have even shown that it can reduce the risk of dementia. So, it’s safe to say that the opposite, a lack of exercise may lead to dementia, is true. That’s exactly what a new study, published in the British Medical Journal, has found, with the age at which a person was obese being a major factor for their dementia risk.

Right now, over one-third of the U.S. population is obese, according to the Centers for Disease Control and Prevention (CDC). That number will increase to about 42 percent by 2030 if the obesity trend continues. Along with that, the rates of Alzheimer’s, a form of dementia, are expected to triple from 5.2 million to somewhere around 11 to 16 million by 2050. With increases in both, surely not only a result of an aging baby boomer population, researchers from Oxford University were interested in seeing how the two correlated.

They found that the age at which a person was obese was linked to their chances of developing dementia. People who were recorded as being obese for the first time in their 30s were most likely to develop dementia after 70 years old. The researchers also found that patients whose first record of obesity came in their 80s or 90s developed dementia at an even lower rate than healthy control subjects of the same age — perhaps all those years of being a healthy weight protected their brains.

Their most interesting finding, however, was that the ages in-between were somewhat of a transitional period, where increasing age was eventually associated with a lowering of dementia risk. People in their 40s and 50s were still at an increased risk of dementia if they were recorded as obese for the first time. But their risk began to decrease once they hit their 60s, becoming on par with the rest of the population. In their 70s, becoming obese did virtually nothing to spur dementia development.

The researchers couldn’t give an explanation as to why younger obese people developed dementia more often. However, they speculated that it could have something to do with a higher body mass index being linked to an increased risk of heart disease and diabetes, two diseases that are also linked to an increased risk of dementia. Another study from last year also suggested that a protein the liver uses to metabolize fat was being pulled from the hippocampus, which is responsible for memory consolidation. To put it simply, the liver’s stores of the protein weren’t enough to handle all the fat, so it had to take some from the hippocampus, thus reducing the brain’s ability to hold memories.

The researchers acknowledged that these were questions they or other research teams still needed to answer. “It cannot be lightly ignored, given the prevalence and importance of both obesity and dementia,” they wrote.

Source: Wotton C, Goldacre M. Age at obesity and association with subsequent dementia: record linkage study. BMJ. 2014.