Forget the trope about bickering old couples constantly at war. It turns out that staying marrie actually may help stave off the effects of depression.

In one of the first studies of its kind, Hui Liu, Ph.D., a professor of sociology, and colleagues at Michigan State University analyzed four groups of unmarried individuals: divorced or separated; widowed; never married; and cohabiters. Among them, the divorced had the highest risk of dementia.

“Marital status is an important but overlooked social risk/protective factor for dementia.” Liu said.

Investigators considered data from the Health and Retirement Study, from 2000 to 2014. The sample included more than 15,000 respondents aged 52 or more years in 2000, measuring their cognitive function every two years, in person or via telephone.

The study comes at a time when 5.8 million people nationwide are living with Alzheimer’s disease and related dementias, costing $290 billion, according to the Alzheimer’s Association. It’s a serious public health concern, Liu said.

Full findings appear in the Journals of Gerontology.