Dogs have been dining on human food scraps since the early days of their domestication, it appears.
Our canine companions developed the ability to digest starchy foods during the farming revolution thousands of years ago, according to DNA evidence.
Scientists think dogs may have been domesticated from wolves when they came into settlements, scrounging for food.
Modern dogs can tolerate starch-rich diets, unlike their wolf cousins, which are carnivores.
A study of DNA extracted from the bones and teeth of ancient dogs at archaeological sites in Europe and Asia suggests their ability to eat starchy foods goes back millennia.
Lead researcher Dr Morgane Ollivier of ENS de Lyon, France, said human cultural development has influenced the first domesticated animal, the dog.
DNA samples from 8,000 to 4,000 years ago show the dog's ability to digest starch is ancient - hailing back to a time when hunter-gatherer societies adopted agriculture.
"As it was absent in samples coming from hunter-gatherers' contexts, we linked it to the development of agriculture in early farming society," Dr Ollivier told BBC News.
"This probably constituted an important selective advantage for dogs feeding on human leftovers within a farming context.
"It's a lovely example of parallel evolution of human culture (emergence of agriculture) and the dog genome."
Scientists are divided over how dogs became domesticated from wolves.
One suggestion is that ancient hunter-gatherers used wolves as hunting companions or guards, gradually training and taming them.
But others argue that domestication started later, when wolves stole food leftovers from settlements and began to live alongside people.
The new research, published in the journal Royal Society Open Science, looked at ancient DNA from dog bones at eight archaeological sites in Europe and Turkmenistan.
It adds weight to the idea that dogs became domesticated when they crept into human settlements to steal food, gradually evolving the ability to thrive on a human diet.
A previous study found that modern dogs have genes for digesting starches, setting them apart from wolves.
The dog is estimated to have split from the wolf around 15,000 years ago.
Exactly how and when humankind's relationship with dogs began is still a matter of debate.
And some propose that domestication of dogs may have happened several times during history.
Follow Helen on Twitter.