Humans and dogs have come a long, long way together. For tens of thousands of years, as our species hunted, foraged, farmed, and explored, canines have been by our side.

Today, while many large predators face endangerment and extinction from human hunting and competition, dogs, which are descended from grey wolves, remain the most prolific carnivores on Earth.

Far from our rivals, they are now said to be our best friends. So how did this remarkable companionship evolve? Why didn't our encounters end more violently?

Scientists in Finland have now put forward an intriguing answer. Instead of being drawn to discarded human food, hunters and gatherers might have fed wild wolves some of the excess meat their bodies didn't need.

Calculating the leftover energy from ancient wolf and human meals, the authors found little competition between the two species during the Last Glacial Maximum more than 20,000 years ago.

Amid these harsh arctic winters, the meat on prey inevitably grew leaner, containing less fat and carbohydrates, which is what the human diet at this time was lacking. Instead, the meat became choc-a-block full of protein, which humans can only stomach in moderation.

Ancient wolves, on the other hand, preferred winter prey like horses, moose, and deer, which had protein ratios well over what early humans could consume. As a result, there was a surplus of lean meat in the coldest months of the year, the authors say – too much for hunter-gatherers to handle.

"This 'overproduction' of protein in arctic and subarctic environments could easily have been fed to wolves/dogs when kept as a pet," researchers contend.

"Therefore, in the short term over the critical winter months, wolves and humans would not have been in competition over resources and may have mutually benefited from each other's companionship. This would have been critical in keeping the first proto-dogs for years and generations."

In no way does this hypothesis end the debate over wolf domestication. The origin of dogs is contested on pretty much all points, from what to where to when, but one of the most fascinating questions is why.

Genetic studies have revealed modern-day dogs are descended from grey wolves, and it's often said these wild carnivores were drawn to our leftovers, milling around on the fringes of our prehistoric camps and growing steadily tamer over time. In other words, dogs may have domesticated themselves.

Another popular idea gives humans more power. It suggests hunter-gatherers actively tamed dogs for hunting, possibly by raising stray or injured wolves as pets.

The new paper argues that "both hypotheses are problematic".

Untamed wolves, for example, were probably not great hunting partners. Such collaboration would have taken time and patience, which the authors say "is not likely to have happened during the initial pet stage but later when dogs were domesticated and sociable with humans".

The idea that wolves were attracted to our discarded food may also be wrong. Evidence suggests early dogs were not able to digest human scraps and mainly ate protein in the form of lean meat.

Dogs, therefore, only acquired their taste for vegetables and other human foods later.

Yet the timeline of dog evolution remains unclear. At some point between 27,000–40,000 years ago, it's thought that wolves became domesticated, and during this time, hunter-gatherers may very well have captured and raised wolf pups.

Keeping such pets would have required an excess of food over several generations, which is probably why many animals kept during hunter-gatherer times were not actually tamed.

As such, some think it was the advent of agriculture that truly deepened our relationship with wolves, although humans didn't make that transition until about 10,000 years ago. Our relationship with dogs precedes this, and the new research helps explain how that's possible.

"According to our theory, late Pleistocene hunter-gatherers in Eurasia would have had enough free/excess animal derived calories to feed proto-dogs/captured wolves during lean winter months and therefore humans and canids would not have been in competition over resources," the authors of the new study conclude.

"Given that there would not have been competition over resources, even a small benefit from keeping captive wolves, such as hunting aid or protection against predators, would have been advantageous for both species."

This might also explain how dog domestication could have arisen independently multiple different times across Eurasia.

This a controversial hypothesis that's only been introduced in recent years. In 2016, genetic research suggested the first domestic dogs appeared on both sides of the Eurasian continent more than 12,000 years ago, before later meeting and mixing.

In 2017, however, further genetic research revealed a single location of origin more than 20,000 years ago.

It's still unclear which hypothesis is right, but given the food humans and wolves used to eat, the former explanation may not be as far fetched as some think.

"That the first domesticated animal was a large carnivore, who would have been a competitor for food – anyone who has spent time with wild wolves would see how unlikely it was that we somehow tamed them in a way that led to domestication," Brian Hare, director of the Duke University Canine Cognition Center, told the Smithsonian in 2018.

But perhaps we lived in more harmony than all that. If grey wolves and humans were not competing for the same resources, the idea that we domesticated wild animals in multiple locations of the arctic and subarctic appears more feasible.

Making friends with wolves might have been easier than it seems.

The study was published in Scientific Reports.