They are officially the happiest people on Earth and now scientists think they know why life is such a dream for the Danes.

The key to unbridled contentment appears to be Danish DNA.

Researchers who looked at survey data from 131 countries found that the closer a nation was genetically to the Danes, the happier its people were.

Danish birth was also associated with specific versions of a gene that influences brain levels of the mood chemical serotonin.

Compared with people from other countries, Danes were less likely to possess a short version of the gene linked to low levels of life satisfaction.

Economist Dr Eugenio Proto, from the University of Warwick's Centre for Competitive Advantage in the Global Economy (Cage), said: "We looked at existing research which suggested that the long and short variants of this gene are correlated with different probabilities of clinical depression, although this link is still highly debated.

"The short version has been associated with higher scores on neuroticism and lower life satisfaction.

"Intriguingly, among the 30 nations included in the study, it is Denmark and the Netherlands that appear to have the lowest percentage of people with this short version."

Serotonin is a neurotransmitter that helps to relay nerve signals.

A deficiency of the chemical in the brain is strongly linked to depression while levels are boosted by the drug Ecstasy.

Further evidence suggested that happiness can spread between continents in immigrant genes.

Co-author Professor Andrew Oswald, also from the University of Warwick, said: "We used data on the reported well-being of Americans and then looked at which part of the world their ancestors had come from.

"The evidence revealed that there is an unexplained positive correlation between the happiness today of some nations and the observed happiness of Americans whose ancestors came from these nations, even after controlling for personal income and religion.

" This study has used three kinds of evidence and, contrary to our own assumptions when we began the project, it seems there are reasons to believe that genetic patterns may help researchers to understand international well-being levels.

"More research in this area is now needed and economists and social scientists may need to pay greater heed to the role of genetic variation across national populations."

The scientists adjusted for a range of other influences on happiness besides genes, including gross domestic product, culture, religion, state welfare and geography.

Last year's World Happiness Report from the United Nations ranked Denmark the happiest nation on Earth, with an average life satisfaction score of 7.69 out of 10.

It was followed by four other northern European countries, Norway, the Netherlands, Switzerland and Sweden.

The UK was ranked 22nd on the list of 156 countries, with a score of 6.88. The world's most miserable country was said to be Togo, west Africa, which managed only 2.93 on the satisfaction scale. Other African countries also dominated the bottom of the ratings.

Denmark has also topped the European Commission's "Eurobarometer" table of citizen well-being and happiness every year since 1973.

The new research is published by the German economic research institute IZA in its Discussion Paper series.