(CNN)For hundreds of years, dogs of all shapes and sizes -- labradors and terriers, chihuahuas and spaniels -- have held the position of man's best friend.
Now, a study published Friday in the journal Science has shown that the genetic diversity in modern dogs can be traced back to the end of the last Ice Age, linking Fido and Rex to ancient canine populations.
Researchers studied DNA extracted from bones from ancient dogs for clues to evolutionary changes that occurred thousands of years ago, and found that just after the Ice Age, there were at least five types of dog with distinct genetic ancestries. They found that dog lineages have "mixed and combined," and are still present in the dogs of today.
"Already by 11,000 years ago -- before agriculture, and before any other animal had been domesticated -- dogs had not only been domesticated, but they had already diversified genetically and likely spread across large parts of the world," Anders Bergstrom, lead author and post-doctoral researcher in the Ancient Genomics Laboratory at London's Francis Crick Institute, told CNN.
The team of researchers, comprising scientists at the Francis Crick Institute, the University of Oxford and the University of Vienna and archaeologists from more than 10 countries, found that that while these early lineages have changed and mixed over the past 11,000 years, they are still represented in dog populations around the world.
Chihuahuas have an ancient lineage
Rhodesian ridgebacks, while mostly European in ancestry, contain some DNA from an ancient Middle Eastern or African lineage, Bergstrom said, while some dogs in Siberia and the Arctic, such Siberian huskies, get much of their DNA from an ancient Siberian lineage.
Meanwhile, dog breeds from Mexico -- such as chihuahuas and Mexican hairless dogs -- are largely European in their lineage but retain some pre-Columbian DNA.
"All dog breeds from Europe share a common history that started with an ancient mixture, many thousands of years ago, between two very distinct dog lineages -- one related to dogs in the Near East, and the other related to dogs in Siberia. This ancient mixing event between these two lineages gave rise to the European dog gene pool which later would give rise to all present-day European dog breeds," Bergstrom said.
The researchers also compared the evolution in dog history with changes in human history, evolution and migration.
"We find that when we compare the history of dogs to the history of humans, to a quite large degree they mirror each other, suggesting that in many cases, the history of dogs has been shaped by humans," Bergstrom said.
"In many cases humans would simply bring their dogs with them as they migrated and moved across the world," he added.
"But in some cases dogs display different history, suggesting there were more complex factors at play: Perhaps sometimes people moved without bringing their dogs, or perhaps sometimes dogs were traded between human groups," he said.
European dogs have lost their diversity -- but no one knows why
And while modern European dogs appear to come in such different shapes and sizes, genetically, they share a recent common ancestor and are not as genetically diverse as they once were.
Bergstrom told CNN that before 4,000-5,000 years ago, Europe had a greater diversity of dogs, with some animals similar to Middle Eastern, Siberian and "everything in-between" dogs.
At some stage, however, this diversity was lost, and is not found in today's European dogs.
"If we look at present-day (European) dogs, despite their enormous variation in terms of what they look like they actually derive from just a small subset of the diversity that used to exist in Europe," he said.
"It's a bit of a mystery how this happened," Bergstrom told CNN, "but likely at some point a single population of dogs banded across Europe and replaced everyone else."