A comparison of the genetic make-up of dogs and wolves has revealed the most crucial DNA changes that brought man's best friend into being.
Fossil evidence suggests that dogs were domesticated from wolves about 10,000 years ago.
Crucially, this is also the time when humankind began to swap their former nomadic lifestyles for a more urban existence underpinned by the development of agriculture, suggesting that the two might be connected.
Uppsala University scientist Erik Axelsson and his colleagues compared the genetic sequences of 12 wolves with 60 domestic dogs representing 14 different breeds.
The team combed the resulting DNA data looking for genome regions where the dogs and wolves were consistently different between the two species.
Thirty-six such regions, containing 122 genes, were identified. A large number of them are known to play a role in brain development, which fits with the behavioural differences between dogs and wolves.
But a surprise also emerged. A number of genes related to starch metabolism and glucose absorption were also very different in the dogs compared with their lupine cousins.
Specifically, while wolves - which eat only a carnivorous diet - have just two copies of a gene for digesting starch, which is found only in plant matter, dogs have up to 40 copies and express the gene at much high levels.
According to the team, this reflects an adaptation by dogs to scavenging from human waste dumps, which would have contained starch-rich foodstuffs.
Such leftovers would have become increasingly abundant ashumans eschewed hunter-gathering behaviours, embraced agriculture and established permanent settlements.
"Our findings suggestes that the development of agriculture catalysed the domestication of dogs," the team suggest in their paper, published this week in Nature.
Many studies have shown that dogs are very good at paying attention to people. For example, if you point to a hidden treat, they will go to where you pointed. They also have the ability to learn several human words.