Being overweight is not just bad for waistlines but for brains too, say researchers who have linked obesity to declining mental performance.
Experts are not sure why this might be, but say metabolic changes such as high blood sugar and raised cholesterol are likely to be involved.
Obesity has already been tipped as a risk factor for dementia.
The work, published in Neurology, tracked the health of more than 6,000 British people over a decade.
The participants, who were aged between 35 and 55, took tests on memory and other cognitive skills three times over a 10-year period.
People who were both obese and who had unhealthy metabolic changes showed a much faster decline on their cognitive test scores compared to others in the study.
The experts stress that they only looked at cognitive function, not dementia.
The boundary between normal ageing, mild cognitive impairment and dementia is blurred - not all impairment leads to dementia.
All of the study participants came from one group of civil service workers, which may mean the findings may not apply more generally to other populations.
They said: "More research is needed to look at the effects of genetic factors and also to take into account how long people have been obese and how long they have had these metabolic risk factors and also to look at cognitive test scores spanning adulthood to give us a better understanding of the link between obesity and cognitive function, such as thinking, reasoning and memory."
Shirley Cramer of the Alzheimer's Research UK said: "We do not yet know why obesity and metabolic abnormality are linked to poorer brain performance, but with obesity levels on the rise, it will be important to delve a little deeper into this association.
"While the study itself focuses on cognitive decline, previous research suggests that a healthy diet, regular exercise, not smoking and controlling blood pressure and cholesterol in midlife can also help stave off dementia. With dementia figures spiralling towards a million, the findings suggest we should be conscious of our general health throughout life."