According to a latest study, modern humans got key immune system genes that help them fight illness and disease through sexual encounters with archaic relatives like Neanderthals.

Researchers used DNA inherited from the Neanderthals and the Denisovans, the recently discovered hominids, to find out what genes intersected.

By now, scientists know that four percent of Neanderthal DNA and up to six percent of Denisovan DNA are present in some modern humans in Europe, Asia and Oceania. Scientists believe that these genes must have helped modern humans thrive, while migrating throughout the world.

The cross-breeding wasn't just a random event that happened, it gave something useful to the gene pool of the modern human, said Stanford University's Peter Parham, senior author of the study in the journal Science.

The study did a close analysis of a gene group called human leukocyte antigen (HLA) class I genes, responsible for making HLA proteins that help the immune system adapt to defend against new pathogens that could cause various infections, viruses and diseases.

Researchers studied the region of the archaic genomes where the HLA genes were located, and then compared them with the HLA regions of modern-day humans.

After the analysis, researchers were able to trace the origin of one gene type, HLA-B*73, to the Denisovans, who are believed to be mated with humans arriving in West Asia on their way out of Africa. The variant is more common among people in west Asia than modern African populations, AFP reported.

When modern humans came out of Africa, they were going into a new environment. This gave them an advantage. It was a rapid way of acquiring defense, said Laurent Abi-Rached, a French researcher and lead author of the study.

According to the study, the prehistoric HLA genes have multiplied among modern humans and are seen in over half of Eurasians today. Scientists estimated that over half of the genetic variants in one HLA genes in Europeans could be originated from Neanderthal or Denisovan DNA, while for Asians; the amount was more than 70 percent. In people from Papua New Guinea, it was 95 percent, Los Angeles Times reported.

The study said that the HLA system of our ancestors might be suitable for African, but inexperienced to bacteria, viruses and parasites that existed in Europe or Asia. Hence, mating and mixing genomes with those of Neanderthals and Denisovans could have been a prompt way to boost up their immune system to fight new diseases.

Although the study showed that some mating must have occurred between modern humans and archaic humans, but the findings didn't say anything about whether the relationships were violent or consensual, short or long-term.

Neanderthals, who populated Europe and parts of Asia, died off some 30,000 years ago. Both Neanderthals and the Denisovans shared a common ancestor with modern humans about 400,000 years ago.

Scientists hope that the research will pave the way for new treatment of modern diseases.