The dirt scattered across the floor of an ancient, remote cave in Mexico has yielded a new source of viable ancient DNA.

For the first time, scientists have sequenced ancient DNA from soil samples - and it's all thanks to the Upper Paleolithic bears that prolifically used the cave as their toilet around 16,000 years ago.

The scientists describe their work as " the Moon landing of genomics", as the breakthrough means fossilized remains are no longer the only way of obtaining ancient DNA. Further, it shows ancient DNA can now be studied in the context of populations, rather than scattered, fragmentary individuals.

"When an animal or a human urinates or defecates, cells from the organism are also excreted. And the DNA fragments from these cells are what we can detect in the soil samples," explained geneticist Eske Willerslev of the University of Copenhagen in Denmark.

"Using extremely powerful sequencing techniques, we reconstructed genomes - genetic profiles - based on these fragments for the first time. We have shown that hair, urine, and feces all provide genetic material which, in the right conditions, can survive for much longer than 10,000 years."

Chiquihuite Cave, where the samples were obtained, is well known as a site of historical significance. Many stone tools and fragments, dating back to between 25,000 and 30,000 years ago, show a period of human occupation – but humans weren't the only ones who made use of the cave.

Bones and traces of DNA also revealed the presence of a range of animals, including bears, bats, voles, rodents, and kangaroo rats. Using those samples, Willerslev and his team have now sequenced and recreated in full the genomes of two Upper Paleolithic bears.

The first specimen was the ancestor of the modern American black bear (Ursus americanus), which still roams the forests of the North American continent. The second was the now-extinct giant short-faced bear (Arctodus simus), one of the largest bears that ever lived, which died off at the end of the last ice age about 11,000 years ago.

010 bear dnaSampling the different cultural layers in the cave. (Devlin A. Gandy)

The researchers then compared these genomes to those of other bears, including 83 present-day black bears from the US and Canada, and three giant short-faced bears that lived in the Yukon in Canada about 22,000 years ago, based on an analysis of their fossilized remains.

They found that the Chiquihuite black bears are closely related to modern bears in North America, but also share ancestry with black bears in Alaska. The researchers also discovered that the Chiquihuite bears belong to the eastern lineage, and that this lineage was first to diverge from other present-day populations of American black bears.

The DNA of the giant short-faced bears was pieced together using the DNA of all eight modern bears in the Ursidae family, as well as three extinct bears, and the three giant short-faced bears in the Yukon Territory.

"The short-faced bears that lived in northern Mexico were distinctly different from the population of [short-faced] bears living in north-western Canada," said geneticist Mikkel Winther Pedersen of the University of Copenhagen.

"This is an excellent example of the new knowledge that suddenly becomes available when you reconstruct genomes based on DNA fragments extracted from soil."

In addition to the bear discoveries, which fill in some gaps in our knowledge of the animals' ancestry in the Americas, the results show that we can now glean much more from environmental DNA than was previously possible, the researchers said.

Fragments of DNA found in sediments used to only show that a particular species was present, and when. Now, using the team's techniques, scientists may be able to learn a lot more about these animals, such as where they fit in their family tree, and how animals migrated and diverged from their common ancestors.

"All over the world, everyone scientifically involved in the study of ancient DNA recognized the need to reconstruct genomes from fragments found in soil or sediment. Being able to do that for the first time means we have opened up a new frontier," Willerslev said.

"Analysis of DNA found in soil could have the potential to expand the narrative about everything from the evolution of species to developments in climate change – this is the Moon landing of genomics because fossils will no longer be needed."

The team's research has been published in Current Biology.