The scientists at the University of Uppsala and the Centre for Clinical Research in Västerås studied two genes - 5-HTT and MAOA. Both genes play a role in how the brain handles signal substances including dopamine and serotonin.
The study, carried out on people between the ages of 16 and 19, showed that boys with a short variant of MAOA were more likely to display anti-social behaviour and drink to excess if brought up in a poor psychosocial environment.
In girls, the long variant of the same gene was likely to increase the risks of poor behaviour, when combined with a poor environment.
Results for the 5-HTT gene showed the opposite effect. The short variant of the gene affected girls negatively. In combination with a poor environment, the gene increased the risk of depressive symptoms in girls. For boys, the long variant increased the risk of depression.
The results surprised the researchers behind the study.
"We first thought that something had gone wrong," said Professor Lars Oreland, who led the study to Svenska Dagbladet.
Continued research confirmed the link.
Oreland said that there might never be an answer as to why the two genes and their variants affect men and women differently, but added that he expected the results would enable improvements in psychiatric care.