When research found depression was more likely among people who had a vitamin D deficiency, the idea that taking the vitamin might help some avoid this all-too-common problem naturally followed. A new study seems to contradict that idea, however. It reports that taking a vitamin D supplement offered no protection against depression as previously thought.

Depression is the top cause of disability among people aged 15 to 44 in the U.S. It is a serious mental health condition that affects seven percent of the population. Depression does not have a single cause, but can be triggered by many factors including genetics, trauma or life circumstances.

It still may be a good idea to take a supplement containing vitamin D for the role it plays in bone and metabolic health.

Several older studies appeared to show that people who had low blood levels of vitamin D were at higher risk for depression in later life, but none of those studies included large numbers of people. The new study, performed at Massachusetts General Hospital, involved over 18,000 participants, all of whom were aged 50 and older and showed no clinical signs of depression or any indicators of it when the study began.

Vitamin D3 supplements were given to half of the people in the study for five years, while the other half received a placebo during that time.

The risk of depression was not significantly different between the people in the study who took the vitamin D supplement and those who took the placebo. The mood scores between the two groups of people over the course of the study were also similar.

The difference between the new findings and the old research comes down to numbers. “One scientific issue is that you actually need a very large number of study participants to tell whether or not a treatment is helping to prevent development of depression,” said Olivia I. Okere, one of the researchers, in a statement. “With nearly 20,000 people, our study was statistically powered to address this issue.”

Vitamin D is sometimes called the “sunshine vitamin,” because it can be created in the body when our skin is exposed to the sun. There are few good food sources of the vitamin. Deficiencies are common among seniors and most likely to occur when one doesn't get enough sun exposure or if our body has difficulty absorbing the vitamin.

If you are experiencing some of the symptoms of depression, such as a low mood and perhaps not sleeping well or sleeping too much, see a mental health professional. There are good therapies available, but vitamin D doesn’t seem to be one of them. It still may be a good idea to take a supplement containing vitamin D, however. It plays a role in bone and metabolic health. Talk to your doctor about whether vitamin D is right for you.

The study is published in JAMA.