Virus-fighting genes inherited from different ancient human sub-species have had a positive effect on our fitness, according to U.S. researchers .
Cross- breeding between ancestors of modern humans and their extinct close relatives passed down specific genes which can still be found in our DNA.
Improvements in the Homo sapiens' immune system may also have been inherited from the Denisovans - a now-vanished human sub-species from eastern Asia.
Scientists discovered last year that ancient intimate relations meant as much as 4 per cent of the DNA of some people living today was Neanderthal.
A similar genetic study showed that up to six per cent of the modern human genome, or genetic code, was Denisovan in origin.
Lead researcher Professor Peter Parham, from Stanford University, California.said cross-breeding contributed to our gene pool.
He said: 'The cross-breeding wasn't just a random event that happened, it gave something useful to the gene pool of the modern human,'
Ancestors: Scientists discovered as much as 4 per cent of the DNA of some people living today is Neanderthal
Neanderthals, who lived in western Asia and Europe, co-existed with early modern humans for several thousand years before dying out around 30,000 years ago.
Homo sapiens, Neanderthals and Denisovans split into different populations from a common African ancestor around 400,000 years ago
The research, published today in the journal Science, focused on immune system elements called HLA genes.
They are critical to the body's ability to identify and destroy harmful foreign invaders and are among the most variable and adaptable of human genes.
DNA: Genes passed down from ancient human sub-species have improved our immune systems
Being flexible helps them stay ahead in the arms race with rapidly evolving viruses.
By comparing the HLA genes of modern and extinct humans, the scientists were able to show that certain HLA carried by people today were inherited from Neanderthals and Denisovans.
The ancient genes were analysed by looking at DNA extracted from fossil bones.
Within one class of HLA gene, the experts estimate that Europeans owe half their variants to interbreeding with Neanderthals and Denisovans, Asians 80 per cent, and people from Papua New Guinea up to 95 per cent.
The same pattern of inheritance was not seen in other regions of the human genome.
Researcher Dr Laurent Abi-Rached said: 'The HLA system is unique in its diversity and the strength of natural selection acting on it.
'But it's possible that other gene systems, particularly the ones under similar pressure for variation, could show a similar pattern.'