A newly published study says that the key to keeping your brain sharp as you age is maintaining a healthy heart.

It showed more cognitive decline in people who had more risk factors for heart disease, including diabetes, high blood pressure, high cholesterol and obesity, compared to people with healthier hearts.

» RELATED: Study finds board games may help prevent cognitive decline

The findings were published Monday in the Journal of the American College of Cardiology, CNN reported.

“There are many specific cardiovascular risk factors, and each can either individually, or in combination, push the fast-forward button towards different aspects of cognitive decline,” said Dr. Richard Isaacson, director of the Alzheimer's Prevention Clinic at Weill Cornell Medicine and NewYork-Presbyterian to the news outlet.

Isaacson was not involved in the study, which spent 21 years following more than 1,500 dementia-free people with an average age of 79.5. The participants who had the highest risk for poor heart health more quickly declined in memory and the ability to compare pictures, patterns numbers, letters or objects, according to the study.

Brain scans some participants took revealed shrinkage of the hippocampus, which plays a major role in learning and memory, and growth in white spots in the brain. Those spots are linked to lowered functionality.

» RELATED: Eat this food twice a week to keep your brain healthy, study says

“High blood pressure and diabetes can accelerate shrinkage of the brain,” Issacson, a trustee of the McKnight Brain Research Foundation, which funds research on age-related cognitive decline, told CNN. “High cholesterol can increase the bad protein that builds up in the brains of people with Alzheimer's. Decreased blood flow can cause ‘white spots’  on brain scans that can lead to slowed processing speed.”

Previous studies have found a link between heart-healthy foods and increased cognitive function.

An analysis from researchers at the National Eye Institute found that people who adhered most closely to the Mediterranean diet had the lowest risk of cognitive impairment. Consuming large amounts of fish and vegetables seemed to have the greatest positive effect.

» RELATED: Study: Mediterranean diet may lead to enhanced cognitive function