Image caption Wolves that coped best with cereals in their diet may be part of the story of domestication

Anyone who owns a dog knows that it will rummage around in the kitchen bin looking for food, given half a chance.

But this annoying behaviour may have a more profound undercurrent than we realise, according to scientists.

A new study of dog genetics reveals numerous genes involved in starch metabolism, compared with wolves.

It backs an idea that some dogs emerged from wolves that were able to scavenge and digest the food waste of early farmers, the team tells Nature journal.

No-one knows precisely when or how our ancestors became so intimately connected with dogs, but the archaeological evidence indicates it was many thousands of years ago.

One suggestion is that the modern mutt emerged from ancient hunter-gatherers' use of wolves as hunting companions or guards.

But another opinion holds that domestication started with wolves that stole our food leftovers and eventually came to live permanently around humans as a result.

"This second hypothesis says that when we settled down, and in conjunction with the development of agriculture, we produced waste dumps around our settlements; and suddenly there was this new food resource, a new niche, for wolves to make use of, and the wolf that was best able to make use of it became the ancestor of the dog," explained Erik Axelsson from Uppsala University.

"So, we think our findings fit well with this theory that the dog evolved on the waste dump," he told BBC News.

Media playback is unsupported on your device Media caption When did dogs stop being wolves

Dr Axelsson and colleagues examined the DNA of more than 50 modern dogs from breeds as diverse as the cocker spaniel and the German shepherd. They then compared their generic genetic information with those of 12 wolves taken from across the world.

The Swedish-US team scanned the DNA sequences of the two types of canid for regions of major difference. These would be locations likely to contain genes important in the rise of the domesticated dog.

Axelsson's group identified 36 such regions, carrying a little over a hundred genes. The analysis detected the presence of two major functional categories - genes involved in brain development and starch metabolism.

In the case of the latter, it seems dogs have many more genes that encode the enzymes needed to break down starch, something that would have been advantageous in an ancestor scavenging on the discarded wheat and other crop products of early farmers.

Image caption Domestication may have forced dogs into a permanent state of puppyhood

"Wolves also have these genes but they don't use them as efficiently as dogs," said Dr Axelsson.

"When we look at the wolf genome, we only see one copy of the gene [for the amylase enzyme] on each chromosome. When we look at the dog genome, we see a range from two to 15 copies; and on average a dog carries seven copies more than the wolf.

"That means the dog is a lot more efficient at making use of the nutrition in starch than the wolf."

As far as the brain development genes are concerned, these probably reflect some of the behavioural differences we now see in the two canids.

The dog is a much more docile creature, the likely consequence of early humans preferentially working with animals they found easier to tame.

"Previous experiments have indicated that when you select for a reduction in aggressiveness, you obviously get a tamer animal but you also get an animal that retains juvenile characteristics much longer during development, sometimes into adulthood," said Dr Axelsson.

This might go some way to explaining the oft-repeated observation that dogs are permanently stuck in a kind of puppyhood.

Open debate

The study of the origin of dogs remains, in many ways, a puzzling field.

Fossil evidence suggests some populations could have been around tens of thousands of years ago, long before the emergence of agriculture. Some researchers have tried to use the regular rate at which error patterns appear in dog DNA as a kind clock to time their rise, but this has produced contradictory results.

One confounding issue might be that domestication happened more than once.

Dr Carles Vila, from the Conservation and Evolutionary Genetics Group at the Donana Biological Station in Seville, Spain, said the debate was wide open.

"I think that modern dogs derived from multiple wolf populations," he observed.

"It could be that dog domestication started once with some animals staying with humans which were then regularly back-crossed with wolves and that could have the same effect. But there could have been completely independent domestications. What is clear is that the number of bone remains is very rare more than 14,000 years ago."

Jonathan.Amos-INTERNET@bbc.co.uk and follow me on Twitter: @BBCAmos