As if we needed another reason to love coffee, it turns out that our loyal friend could also help stave off dementia.

A study published in The Journals of Gerontology found that older women who ingested more caffeine were less likely to experience cognitive impairment. Almost 6,500 women between 65 and 80 years old self-reported their caffeine consumption over 10 years, and the ones drinking more than 261 milligrams of caffeine each day showed a 36 percent reduced risk of dementia, according to the study.

That amount of caffeine could equate to almost three 8-ounce cups of coffee or between five and six cups of black tea. For those who don't drink coffee or tea, consuming the same level of caffeine could take eight 12-ounce cans of soda.

"While we can't make a direct link between higher caffeine consumption and lower incidence of cognitive impairment and dementia, with further study, we can better quantify its relationship with cognitive health outcomes," Ira Driscoll, the study's lead author and a professor of psychology at the University of Wisconsin-Milwaukee, told the Milwaukee Journal Sentinel. "Research on this topic will be beneficial not only from a preventative standpoint but also to better understand the underlying mechanisms and their involvement in dementia and cognitive impairment."

Caffeine could work to protect cognitive function because it binds to the brain's adenosine receptors, according to the study. Those receptors' function becomes "aberrant with both normal aging and age-related pathology."

And Driscoll told the Milwaukee Journal Sentinel that the idea caffeine could protect against cognitive impairment is "exciting given that caffeine is also an easily modifiable dietary factor" with few risks.

Of all the women who participated in the project through the Women's Health Initiative Memory Study, which is funded by the National Heart, Lung, and Blood Institute, 388 were diagnosed with probable dementia. In crunching the data, scientists adjusted for risk factors such as hypertension, smoking, alcohol consumption and preexisting cardiovascular disease, among others.

The study was clear, however, about its own limitations. It noted the demographics of the participants — all postmenopausal women, many of whom were highly educated — may not represent the general population. The researchers also did not discern between dietary sources of caffeine beyond coffee and tea, which means the consumption levels could be underestimated. "Further research is needed in order to assess or confirm the exposure through more objective, biological assays compared to self-reported caffeine intake, and also to isolate potential acute effects that caffeine may have on cognitive performance," the study says.

Understanding the link between caffeine and cognitive function could prove valuable given the age breakdown of society. According to the study, the population is getting steadily older and some predictions say the number of people with dementia will quadruple by 2050.

"There is an alarming need for effective treatments that prevent, delay or slow the disease that is already the sixth leading cause of death in the developed world."

Source: Espeland MA, Driscoll I, and Shumaker SA, et al. Relationships Between Caffeine Intake and Risk for Probably Dementia or Global Cognitive Impairment: The Women's Health Initiative Memory Study. The Journals of Gerontology. 2016.