“It’s one part of the whole package that helps alleviate my depression and helps me to feel better,” he said.

Research on the impact of diet on mental functioning is relatively new, and food studies can be difficult to perform and hard to interpret, since so many factors go into what we eat and our general well-being. But a study of more than 12,000 Australians published in the American Journal of Public Health in 2016 found that individuals who increased the number of servings of fruits and vegetables that they ate reported that they were happier and more satisfied with their life than those whose diets remained the same.

Another study of 422 young adults from New Zealand and the United States showed higher levels of mental health and well-being for those who ate more fresh fruits and vegetables. Interestingly, the same benefits did not accrue to those who ate canned fruits and vegetables. “We think this is due to the higher nutrient content of raw fruits and vegetables, particularly B vitamins and vitamin C, which are vulnerable to heat degradation,” said Tamlin Conner, a study author and senior lecturer at the University of Otago.

One of the first randomized controlled trials to test whether dietary change may be effective in helping to treat depression was published in 2017. In the study, led by Felice Jacka, a psychiatric epidemiologist in Australia, participants who were coached to follow a Mediterranean diet for 12 weeks reported improvements in mood and lower anxiety levels. Those who received general coaching showed no such benefits.

A Mediterranean diet, rich in whole grains, legumes and seafood as well as nutrient-dense leafy vegetables that are high in the fiber, promotes a diverse population of helpful bacteria in the gut. Research suggests that a healthy gut microbiome may be important in the processing of neurotransmitters like serotonin that regulate mood.

“Our imaging studies show that the brains of people who follow a Mediterranean-style diet typically look younger, have larger volumes and are more metabolically active than people who eat a more typical Western diet,” said Dr. Lisa Mosconi, the director of the Women’s Brain Initiative at the Weill Cornell Medical Center in New York. Such brain benefits may be protective against the onset of dementia, she said.

Dr. Mosconi noted that “there is no one diet that fits all” but advises patients to cut out processed foods, minimize meat and dairy and eat more whole foods like fatty fish, vegetables and whole grains and legumes to cut the risk of developing degenerative brain diseases associated with aging.