A “superathlete” gene that helps Sherpas and other Tibetans breathe easy at high altitudes was inherited from an ancient species of human. That’s the conclusion of a new study, which finds that the gene variant came from people known as Denisovans, who went extinct soon after they mated with the ancestors of Europeans and Asians about 40,000 years ago. This is the first time a version of a gene acquired from interbreeding with another type of human has been shown to help modern humans adapt to their environment.

Researchers have long wondered how Tibetans live and work at altitudes above 4000 meters, where the limited supply of oxygen makes most people sick. Other high-altitude people, such as Andean highlanders, have adapted to such thin air by adding more oxygen-carrying hemoglobin to their blood. But Tibetans have adapted by having less hemoglobin in their blood; scientists think this trait helps them avoid serious problems, such as clots and strokes caused when the blood thickens with more hemoglobin-laden red blood cells.

Researchers discovered in 2010 that Tibetans have several genes that help them use smaller amounts of oxygen efficiently, allowing them to deliver enough of it to their limbs while exercising at high altitude. Most notable is a version of a gene called EPAS1, which regulates the body’s production of hemoglobin. They were surprised, however, by how rapidly the variant of EPAS1 spread—initially, they thought it spread in 3000 years through 40% of high-altitude Tibetans, which is the fastest genetic sweep ever observed in humans—and they wondered where it came from.

Now, an international team of researchers has sequenced the EPAS1 gene in 40 Tibetans and 40 Han Chinese. Both were once part of the same population that split into two groups sometime between 2750 to 5500 years ago. Population geneticist Rasmus Nielsen of the University of California, Berkeley, his postdoc Emilia Huerta-Sanchez, and their colleagues analyzed the DNA and found that the Tibetans and only two of the 40 Han Chinese had a distinctive segment of the EPAS1 gene in which five letters of the genetic code were identical. When they searched the most diverse catalog of genomes from people around the world in the 1000 Genomes Project, they could not find a single other living person who had the same code.

Then, the team compared the gene variant with DNA sequences from archaic humans, including Neandertals and a Denisovan, whose genome was sequenced from the DNA in a girl’s finger bone from Denisova Cave in the Altai Mountains of Siberia. The Denisovan and Tibetan segments matched closely.

The team also compared the full EPAS1 gene between populations around the world and confirmed that the Tibetans’ inherited the entire gene from Denisovans in the past 40,000 years or so—or from an even earlier ancestor that carried that DNA and passed it on to both Denisovans and modern humans. But they ruled out the second scenario—that the gene was inherited from the last ancestor that modern humans shared with Denisovans more than 400,000 years ago because such a large gene, or segment of DNA, would have accumulated mutations and broken up over that much time—and the Tibetans’ and Denisovans’ versions of the gene wouldn’t match as closely as they do today.

But just how did the Tibetans inherit this gene from people who lived 40,000 years before them in Siberia and other parts of Asia? Using computer modeling, Nielsen and his team found the only plausible explanation was that the ancestors of Tibetans and Han Chinese got the gene by mating with Denisovans. The genome of this enigmatic people has revealed that they were more closely related to Neandertals than to modern humans and they once ranged across Asia, so they may have lived near the ancestors of Tibetans and Han Chinese. Other recent studies have shown that although Melanesians in Papua New Guinea have the highest levels of Denisovan DNA today (about 5% of their genome), some Han Chinese and mainland Asians retain a low level of Denisovan ancestry (about 0.2% to 2%), suggesting that much of their Denisovan ancestry has been wiped out or lost over time as their small populations were absorbed by much larger groups of modern humans.

Although most Han Chinese and other groups lost the Denisovans’ version of the EPAS1 gene because it wasn’t particularly beneficial, Tibetans who settled on the high-altitude Tibetan plateau retained it because it helped them adapt to life there, the team reports online today in Nature. The gene variant was favored by natural selection, so it spread rapidly to many Tibetans.

A few Han Chinese—perhaps 1% to 2%—still carry the Denisovan version of the EPAS1 gene today because the interbreeding took place when the ancestors of Tibetans and Chinese were still part of one group some 40,000 years ago. But the gene was later lost in most Chinese, or the Han Chinese may have acquired it more recently from interbreeding with Tibetans, Nielsen says.

Either way, what is most interesting, Nielsen says, is that the results show that mating with other groups was an important source of beneficial genes in human evolution. “Modern humans didn’t wait for new mutations to adapt to a new environment,” he says. “They could pick up adaptive traits by interbreeding.”

The discovery is the second case in which modern humans have acquired a trait from archaic humans, notes paleogeneticist Svante Pääbo of the Max Planck Institute for Evolutionary Anthropology in Leipzig, Germany, whose team discovered the Denisovan people. Earlier this year, another team showed that Mayans, in particular, have inherited a gene variant from Neandertals that increases the risk for diabetes.

The ultimate irony, Nielsen notes, is that, once we got this beneficial gene, we never returned the favor. Instead, we may have helped drive the Denisovans extinct.