An international study led by the University of Edinburgh has discovered more than 100 genes linked to depression.
Experts studied data from two million people in 20 countries.
They found genetic variations affected nerve connections in the parts of the brain controlling decision-making and personality.
The more gene variations their subjects had, the more likely they were to be depressed.
Researchers believe their discovery could lead to better treatments.
Depression will affect one person in six and is the world's biggest cause of disability.
It can reveal itself as low mood, lethargy, loss of pleasure, no appetite, diminished libido, "tail-chasing" thoughts and more.
Some suffer for a couple of months once in a lifetime. In others it can remain a severe and chronic condition involving admission to a psychiatric hospital and in the worst cases, suicide.
Dr Rebecca Lawrence says everyone is different.
She has a mood disorder which produces spells of depression so severe she receives electro-convulsive therapy (ECT).
"For me it would be a complete lack of energy, just lack of ability to really do anything," she says.
"A lack of hope as well, that things aren't worth doing.
"And also quite a strong feeling of fear of... anything."
Many factors can trigger a depression severe enough to warrant medical help, including trauma, bereavement, stress, lifestyle.
The fact that depression can also run in families strongly suggested that genetics was playing a role in perhaps a third of cases.
But the precise mechanism has remained obscure until now.
The international study was led by Prof Andrew McIntosh of the University of Edinburgh's Centre for Clinical Brain Sciences.
Changes in DNA
It analysed anonymous health and DNA records.
The data, which was used with the consent of its donors, is held by UK Biobank, the personal genetics and research company 23andMe and the Psychiatry Genomics Consortium.
"We looked to see, in around about two million people, if we could predict using genetics the people who developed depression from those who didn't," Prof McIntosh said.
"We found that there were about a hundred or so changes in their DNA, in their genetic makeup, that made them more likely to develop the condition.
"It was the people that carried over 100 who were much more likely to develop the disorder in future."
The genes involved appear predominantly to affect the junctions between nerve cells in the brain and were more involved with the front of the brain, the complex decision-making and personality parts.
The findings could lead to better targeted treatments and perhaps early warnings that some people are at risk from developing depression.
The study, which has been published in Nature Neuroscience and funded by Wellcome, has also thrown out other intriguing clues.
It identified sections of DNA that were common in people with depression and in those who adopted lifestyle behaviours like smoking.
The findings also shed light on other personality factors, such as a link between neuroticism and becoming depressed.
The Edinburgh team is now collaborating with the National Institute of Health Research's Mental Health BioResource and King's College London.
The new study is called Genetic Links to Anxiety and Depression (GLAD) and is calling for 40,000 volunteers from across the UK to sign up online - and donate some saliva.
The sample is then analysed and researchers extract the information on their genetics and how that relates to their anxiety and depression.
The news of the latest findings brings hope to Rebecca Lawrence. She last had to have ECT late last year and remains on a mixture of antidepressant drugs.
Her day job as a consultant psychiatrist gives her deeper insight than most.
She said: "I worry about over-talking about it sometimes. You feel you might under-talk and over-talk.
"It's a thing in your life along with many other things.
"But it doesn't define you."
If you or someone you know has been affected by mental health problems, these organisations may be able to help.