Updated

Following a diet rich in produce and low in processed meats even if you don't do it perfectly may be helpful in preventing depression, according to a large new study.

To lower the risk of depression, "People can eat everything, but everything in moderation," as long as they try to eat lots of vegetables, fruits, nuts and fish, and avoid fast food and processed meats, said study author Almudena Sanchez-Villegas of the University of Las Palmas de Gran Canaria.

At the start of the study, researchers asked 15,000 Spanish university graduates who had never had depression what they normally ate. Then they asked them again, 10 years later.

The researchers looked at how closely the participants' everyday diets adhered to three healthy diet patterns that involved consuming high amounts of fruits, vegetables, legumes, nuts and fish, and avoiding processed meats. These principles are part of the Mediterranean diet and other healthy diets.

After 8.5 years, 1,550 people in the study reported being diagnosed with depression or using antidepressant drugs.

The researchers found that the people in the study who stuck to the healthy patterns to a moderate or a high extent had a lower risk of depression than those who did not follow these diets at all, or who adhered to them to a low degree.

For example, the risk of depression over the study period for the people who moderately adhered to the Mediterranean diet was about 25 to 30 percent lower than for those who did not adhere to the diet at all, or who adhered to it only to a very small extent, the researchers found. [7 Ways to Recognize Depression in 20-Somethings]

"Even a moderate adherence to these healthydietarypatterns was associated with an important reduction in the risk of developing depression," Sanchez-Villegas told Live Science.

Moreover, the researchers saw no extra benefit for depression risk when participants followed thediets very closely, compared with moderate adherence, she said.

The researchers don't know for sure what may explain the link between these dietary patterns and people's risk of depression. However, one potential mechanism is that people who follow these patterns may have a lower risk of depression because they get adequate levels of some micronutrients, such as B vitamins, folate or zinc all of which are essential to brain health, Sanchez-Villegas said.

Conversely, the people who dont follow these patterns may have a higher risk of depression because of their nutrient deficits, she said.

Sanchez-Villegas' previous research, published in 2006and 2009, also showed a link between following a Mediterranean diet and a lower risk of depression.

The new study was published Sept. 16 in the journal BMC Medicine.

Copyright 2015 LiveScience, a TechMediaNetwork company. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.