The beloved pooch snoring on your couch or sticking a snoot under your arm at dinner time came from a much wilder origin. At some point, dogs diverged from gray wolves under the guidance of domestication, to become the diverse fuzzbutts that fill our homes and hearts with such joy today.

Exactly when and how this process took place, however, is something of a mystery. Now ancient DNA, including that of wolves preserved in permafrost for tens of thousands of years, is shedding some light on how wild wolves became some of our best non-human friends.

"Through this project we have greatly increased the number of sequenced ancient wolf genomes, allowing us to create a detailed picture of wolf ancestry over time, including around the time of dog origins," explained geneticist Anders Bergström of The Francis Crick Institute in the UK.

"By trying to place the dog piece into this picture, we found that dogs derive ancestry from at least two separate wolf populations – an eastern source that contributed to all dogs and a separate more westerly source that contributed to some dogs."

All domestic dogs today, from the teensiest chihuahua to the mightiest mastiff, belong to the same species, Canis familiaris. And all are descended from wolf ancestry shared with today's gray wolf (Canis lupus). But the timeline is murky, and hotly debated. Some scientists controversially suggest that the process began over 100,000 years ago.

Recent work by Bergström and his colleagues included the DNA of 32 dogs dating between 100 and 32,000 years ago. They found that dogs had diversified by 11,000 years ago, so it had to have happened before then. It's generally accepted that domestication and therefore diversification began sometime between 40,000 and 20,000 years ago, and likely more than once, in different parts of the world.

The new work is based on 72 ancient wolf genomes, 66 of which have been newly scanned for this analysis, dating back 100,000 years – covering roughly 30,000 generations of wolves across Europe, Siberia and North America.

These were compared against 68 genomes from modern wolves, ancient and modern dogs, and other canid species, such as coyotes.

Among the samples were some famous recent finds, including the almost perfectly preserved cub Dogor, locked for 18,000 years in the Siberian permafrost, and the 32,000-year-old head of a wolf, also from the Siberian permafrost.

A brown fuzzy wolf-like animal placed on a table'Dogor', an 18,000 year-old wolf puppy from Yakutia. (Sergey Fedorov)

The genomes revealed that both the ancient and the modern dogs are more closely related to ancient wolves in Asia than those that lived in Europe. This suggests domestication and diversification may have begun in the East, rather than the West.

However, something was odd. Early dogs in Northeastern Europe, Siberia, and the Americas derive 100 percent of their DNA from an eastern population of wolves. Early dogs from the Middle East, Africa, and the South of Europe have a DNA contribution from wolves related to modern populations in Southeast Eurasia.

This could support previous findings that dogs were domesticated more than once, in different parts of the world. However, it could also mean that dogs were domesticated first in the East, then mixed with a population of wild wolves.

It's unclear which of these scenarios may have taken place; none of the genomes in the study are a direct match, so more information is needed.

The study also allowed the team to learn more about ancient wolves, and their evolution. In particular, they traced a gene variant that went from being very rare to almost ubiquitous, over the period of about 10,000 years. This mutation affects a gene called IFT88, involved in the development of head and jaw bones, and is still present in almost every dog and wolf today.

The team doesn't know why this mutation became so common, but it may have to do with natural selection; perhaps the types of available prey made changes wrought by the mutation particularly beneficial. It's also possible that the gene does something we don't know about, and the mutation provided an unknown benefit.

"This is the first time scientists have directly tracked natural selection in a large animal over a time-scale of 100,000 years, seeing evolution play out in real time rather than trying to reconstruct it from DNA today," said geneticist and senior author Pontus Skoglund, also of Crick.

"We found several cases where mutations spread to the whole wolf species, which was possible because the species was highly connected over large distances. This connectivity is perhaps a reason why wolves managed to survive the ice age while many other large carnivores vanished."

These findings suggest that such temporally wide-ranging whole-genome studies can give us much more detailed insights into how species move and change over time.

The next stage of the research is to try to further narrow down which wolves were the ancestors of modern dogs. The team is expanding their investigation into regions of the world not covered by this analysis.

The research has been published in Nature.