The citizens of nations which rate themselves happiest are more likely to have a specific allele in their DNA, which is involved in sensory pleasure and pain reduction, researchers found.
They used data from the nationally representative World Values Survey (2000-2014), calculating the average national percentages of respondents who unambiguously reported being 'very happy'.
The researchers, including those from Varna University of Management in Bulgaria, found a strong correlation between a nation's happiness and the presence of the A allele in the fatty acid amide hydrolase (FAAH) gene variant rs324420 in its citizens' genetic make-up.
This allele helps prevent the chemical degradation of anandamide, a substance that enhances sensory pleasure and helps to reduce pain.
Nations with the highest prevalence of the A allele are quite clearly also those who perceive themselves happiest.
These include Ghana and Nigeria in West Africa, and northern Latin American nations, such as Mexico and Colombia, whose citizens are of Amerindian or mixed Euro-American descent.
The Arab nations of Iraq and Jordan, and the East Asian nations of Hong Kong, China, Thailand and Taiwan, which had the lowest prevalence of this allele, were found to be the least likely to rate themselves as 'very happy'.
Genetics also suggests explanations for differences in happiness between European nations.
Northern Europeans such as Swedes were found to have a much higher prevalence of the A allele - and more often rate themselves as being very happy - than their cousins from Central or Southern Europe.
Economic wealth, the type of law governing a nation or disease patterns did not significantly influence national differences in happiness.
However, politics and economics did cause fluctuations in happiness levels in certain countries during the time this study was conducted, researchers said.
Climatic differences were also found to be significantly associated with national differences in happiness.
"It seems that some equatorial and tropical environments select for a higher occurrence of the A allele as a counterbalance to environmental stressors," said Michael Minkov from Varna University of Management.
"We have not shown that a nation's genetic and climatic heritage doom a particular country to a specific happiness score, but that it can still rise and fall because of situational factors," said Michael Bond from the Hong Kong Polytechnic University.
The findings were published in the journal of Happiness Studies.
Get Breaking news, live coverage, and Latest News from India and around the world on NDTV.com. Catch all the Live TV action on NDTV 24x7 and NDTV India. Like us on Facebook or follow us on Twitter and Instagram for latest news and live news updates.