(CNN) -- The link between depression and dementia has always been unclear, but a new study supports the theory that depression increases dementia risk.

The findings, published in the journal Neurology, are based on nearly 1,000 people who were studied for up to 17 years. Researchers evaluated them for depression and dementia using standard clinical tests. Those who were depressed when first examined almost doubled their risk for dementia and also increased their risk for Alzheimer's disease.

"This is probably the best in terms of long-term follow study that I've seen in terms of associating dementia with depression," said Dr. Richard Isaacson, associate professor of neurology at the University of Miami's Miller School of Medicine, who was not involved with the research.

Previous research has also examined depression and dementia, but results have been inconsistent, perhaps because participants were not followed for long enough, said lead author Jane Saczynski, assistant professor of medicine at the University of Massachusetts Medical School.

Participants came from the Framingham Heart Study, a large study that has been going on since 1948 to look at heart disease risk factors in Framingham, Massachusetts. Because of the data already being collected about these people, the study allowed Saczynski's group to control for heart disease, heart attack, stroke, smoking, alcohol use and other factors that could have influenced dementia. The average age of people that Saczynski's study looked at was 79 years old.

The study did not figure out if depression causes dementia, or if something else is involved. That means people with depression are not necessarily destined to get dementia, said Adam Brickman, assistant professor of neuropsychology at Columbia University Medical Center, who did not conduct this study.

If depression is indeed a risk factor for dementia, treating depression should help stave off dementia, but no studies have shown this effect, Saczynski said.

From a practical standpoint, people with depression should be treated, and those who have depression later in life should also be screened for dementia by a neurologist, Isaacson said.

"The earlier we diagnose, the earlier we can treat, and, in my clinical experience, the earlier we treat, the better patients will do," he said.

Another theory about why depression and dementia are linked is that depression could be an early sign of changes in the brain that lead to dementia. Because of the long follow-up period of the study, in which participants who were dementia-free developed the condition many years later, this is a less likely explanation, but was not ruled out in the research, Saczynski said.

Exercise and social engagement have been shown to protect against dementia in other research. Given that depressed people tend to be less active and more withdrawn, these habits could influence the development of dementia, Saczynski said.

Other lifestyle factors have been associated with staving off dementia, such as eating foods rich in omega-3 fatty acids, controlling cholesterol, abstaining from smoking and, for diabetics, controlling blood sugar, Isaacson said. But results are mixed on the dietary supplements front -- nothing is certain, experts say.

The next step in this line of research is to examine brain images to see what roles depression and dementia may play in the brain, and better understand the mechanisms behind the connection between these two disorders, Saczynski said.