A diet heavy in processed and fatty foods increases the risk of depression, according to British research published on Monday.
Researchers at University College London also found that a diet including plenty of fresh vegetables, fruit and fish could help prevent the onset of depression.
They compared participants - all civil servants - who ate a diet largely based on "whole" foods with a second group who mainly ate fried food, processed meat, high-fat dairy products and sweetened desserts.
Taking into account other indicators of a healthy lifestyle such as not smoking and taking physical exercise, those who ate the whole foods had a 26 percent lower risk of depression than those who ate mainly processed foods.
People with a diet heavy in processed food had a 58 percent higher risk of depression.
The researchers put forward several explanations for the findings, which are published in the British Journal of Psychiatry.
Firstly, the high level of antioxidants in fruits and vegetables could have a protective effect, as previous studies have shown higher antioxidant levels to be associated with a lower risk of depression.
Secondly, eating lots of fish may protect against depression because it contains high levels of the sort of polyunsaturated fatty acids which stimulate brain activity.
And they said it was possible that a "whole food" diet protects against depression because of the combined effect of consuming nutrients from lots of different types of food, rather than the effect of one single nutrient.
The researchers concluded: "Our research suggests that healthy eating policies will generate additional benefits to health and well-being, and that improving people's diet should be considered as a potential target for preventing depressive disorders."
The study was carried out on 3,486 people with an average age of 55, who worked for the civil service in London.
Each participant completed a questionnaire about their eating habits, and a self-assessment for depression.