People with both high and low levels of magnesium in their blood may have a higher risk of dementia. That’s according to new research published in Neurology.

Researchers from the Netherlands followed about 9,500 people with an average age of 65 who did not have dementia for a period of eight years. During that time, 823 people developed dementia, and among those, 663 had clinically diagnosed Alzheimer’s disease.

Participants were divided into five groups based on their magnesium levels. According to the researchers, both the low (≤0.79 mmol/L serum magnesium level) and high (≥0.90 mmol/L serum magnesium level) groups were about 30 percent more likely to develop dementia than those in the middle group.

Of the 1,771 people in the low magnesium group, 160 people developed dementia. For the high magnesium group, 179 of the 1,748 people had developed dementia. In the middle group, 102 of the 1,387 people developed dementia.

The results were the same after researchers adjusted for confounding factors, such as alcohol and nicotine use, BMI, and kidney function.

Study author Brenda C.T. Kieboom, M.D., MSc, of Erasmus University Medical Center in Rotterdam, the Netherlands said in a statement that the results, while intriguing, need to be confirmed with additional studies.  And if confirmed, blood tests could be used to screen people for risk.

“Since the current treatment and prevention options for dementia are limited, we urgently need to identify new risk factors for dementia that could potentially be adjusted. If people could reduce their risk for dementia through diet or supplements, that could be very beneficial.”

Foods high in magnesium include spinach, almonds, cashews, soy and black beans, whole grains, yogurt, and avocados.

Kieboom emphasized that the study does not prove that high or low levels of magnesium cause dementia; it only shows an association.