Long ago, before your four-legged best friend learned to fetch tennis balls or watch football from the couch, his ancestors were purely wild animals in competition—sometimes violent—with our own. So how did this relationship change? How did dogs go from being our bitter rivals to our snuggly, fluffy pooch pals?

Related Content This Rock Art May Be the Earliest Depiction of Dogs

The new drama Alpha answers that question with a Hollywood "tail" of the very first human/dog partnership.

Europe is a cold and dangerous place 20,000 years ago when the film’s hero, a young hunter named Keda, is injured and left for dead. Fighting to survive, he forgoes killing an injured wolf and instead befriends the animal, forging an unlikely partnership that—according to the film—launches our long and intimate bond with dogs.

Just how many nuggets of fact might be sprinkled throughout this prehistoric fiction?

We’ll never know the gritty details of how humans and dogs first began to come together. But beyond the theater the true story is slowly taking shape, as scientists explore the real origins of our oldest domestic relationship and learn how both species have changed along canines’ evolutionary journey from wolves to dogs.

When and where were dogs domesticated?

Pugs and poodles may not look the part, but if you trace their lineages far enough back in time all dogs are descended from wolves. Gray wolves and dogs diverged from an extinct wolf species some 15,000 to 40,000 years ago. There’s general scientific agreement on that point, and also with evolutionary anthropologist Brian Hare’s characterization of what happened next. ‘The domestication of dogs was one of the most extraordinary events in human history,” Hare says.

But controversies abound concerning where a long-feared animal first became our closest domestic partner. Genetic studies have pinpointed everywhere from southern China to Mongolia to Europe.

Scientists cannot agree on the timing, either. Last summer, research reported in Nature Communications pushed likely dates for domestication further back into the past, suggesting that dogs were domesticated just once at least 20,000 but likely closer to 40,000 years ago. Evolutionary ecologist Krishna R. Veeramah, of Stony Brook University, and colleagues sampled DNA from two Neolithic German dog fossils, 7,000 and 4,700 years old respectively. Tracing genetic mutation rates in these genomes yielded the new date estimates.

“We found that our ancient dogs from the same time period were very similar to modern European dogs, including the majority of breed dogs people keep as pets,” explained Dr. Veeramah in a release accompanying the study. This suggests, he adds, “that there was likely only a single domestication event for the dogs observed in the fossil record from the Stone Age and that we also see and live with today.”

End of story? Not even close.

In fact, at least one study has suggested that dogs could have been domesticated more than once. Researchers analyzed mitochondrial DNA sequences from remains of 59 European dogs (aged 3,000 to 14,000 years), and the full genome of a 4,800-year-old dog that was buried beneath the prehistoric mound monument at Newgrange, Ireland.

Comparing these genomes with many wolves and modern dog breeds suggested that dogs were domesticated in Asia, at least 14,000 years ago, and their lineages split some 14,000 to 6,400 years ago into East Asian and Western Eurasian dogs ,

But because dog fossils apparently older than these dates have been found in Europe, the authors theorize that wolves may have been domesticated twice, though the European branch didn’t survive to contribute much to today’s dogs. Greger Larson, director of the Wellcome Trust Palaeogenomics & Bio-Archaeology Research Network at Oxford University, suggests that the presence of older fossils in both Europe and Asia, and the lack of dogs older than 8,000 years in between those regions, supports such a scenario.

“Our ancient DNA evidence, combined with the archaeological record of early dogs, suggests that we need to reconsider the number of times dogs were domesticated independently. Maybe the reason there hasn’t yet been a consensus about where dogs were domesticated is because everyone has been a little bit right,' Larson said in a statement accompanying the study.

The many interbreedings of dogs and wolves also muddy the genetic waters, of course. Such events happen to the present day—even when the dogs in question are supposed to be stopping the wolves from eating livestock.

How did dogs become man's best friend?

Perhaps more intriguing then exactly when or where dogs became domesticated is the question of how. Was it really the result of a solitary hunter befriending an injured wolf? That theory hasn’t enjoyed much scientific support.

One similar theory argues that early humans somehow captured wolf pups, kept them as pets, and gradually domesticated them. This could have happened around the same time as the rise of agriculture, about 10,000 years ago. The oldest fossils generally agreed to be domestic dogs date to about 14,000 years, but several disputed fossils more than twice that age may also be dogs or at least their no longer entirely wolf ancestors.

Since more recent genetic studies suggest that the date of domestication occurred far earlier, a different theory has gained the support of many scientists. “Survival of the friendliest” suggests that wolves largely domesticated themselves among hunter-gatherer people.

“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,” says Brian Hare, director of the Duke University Canine Cognition Center.

But, Hare notes, the physical changes that appeared in dogs over time, including splotchy coats, curly tails, and floppy ears, follow a pattern of a process known as self-domestication. It’s what happens when the friendliest animals of a species somehow gain an advantage. Friendliness somehow drives these physical changes, which can begin to appear as visible byproducts of this selection in only a few generations.

“Evidence for this comes from another process of domestication, one involving the famous case of domesticated foxes in Russia. This experiment bred foxes who were comfortable getting close to humans, but researchers learned that these comfortable foxes were also good at picking up on human social cues,” explains Laurie Santos, director of the Canine Cognition Center at Yale University. The selection of social foxes also had the unintended consequence of making them look increasingly adorable—like dogs.

Hare adds that most wolves would have been fearful and aggressive towards humans—because that’s the way most wolves behave. But some would have been friendlier, which may have given them access to human hunter-gatherer foodstuffs..

“These wolves would have had an advantage over other wolves, and the strong selection pressure on friendliness had a whole lot of byproducts, like the physical differences we see in dogs,” he says. “This is self-domestication. We did not domesticate dogs. Dogs domesticated themselves.”

A study last year provided some possible genetic support for this theory. Evolutionary biologist Bridgette von Holdt, of Princeton University, and colleagues suggest that hypersocial behavior may have linked our two species and zero in on a few genes that may drive that behavior.

“Generally speaking, dogs display a higher level of motivation than wolves to seek out prolonged interactions with humans. This is the behavior I’m interested in,” she says.

Von Holdt’s research shows that the social dogs she tested have disruption to a genomic region that remains intact in more aloof wolves. Interestingly, in humans genetic variation in the same stretch of DNA causes Williams-Beuren syndrome, a condition characterized by exceptionally trusting and friendly behaviors. Mice also become more social if changes occur to these genes, previous studies have discovered.

The results suggest that random variations to these genes, with others yet unknown, may have played a role in causing some dogs to first cozy up with humans.

“We were able to identify one of the many molecular features that likely shape behavior,” she adds.

How have dogs changed since becoming our best friends?

Though the origins of the dog/human partnership remain unknown, it’s becoming increasingly clear that each species has changed during our long years together. The physical differences between a basset hound and wolf are obvious, but dogs have also changed in ways that are more than skin (or fur) deep.

One recent study shows how by bonding with us and learning to work together with humans, dogs may have actually become worse at working together as a species. Their pack lifestyle and mentality appear to be reduced and is far less prevalent even in wild dogs than it is in wolves.

But, Yale’s Laurie Santos says, dogs may have compensated in other interesting ways. They’ve learned to use humans to solve problems.

“Several researchers have presented dogs and wolves with an impossible problem (e.g., a puzzle box that can't be opened or a pulling tool that stops working) and have asked how these different species react,” Santos explains. “Researchers have found that wolves try lots of different trial and error tactics to solve the problem— they get at it physically. But at the first sign of trouble, dogs do something different. They look back to their human companion for help. This work hints that dogs may have lost some of their physical problem-solving abilities in favor of more social strategies, ones that rely on the unique sort of cooperation domesticated dogs have with humans. This also matches the work showing that dogs are especially good at using human social cues.”

The relationship has become so close that even our brains are in sync. Witness a study showing that dogs hijack the human brain’s maternal bonding system. When humans and dogs gaze lovingly into one another’s eyes, each of their brains secretes oxytocin, a hormone linked to maternal bonding and trust. Other mammal relationships, including those between mom and child, or between mates, feature oxytocin,bonding, but the human/dog example is the only case in which it has been observed at work between two different species.

The intimacy of this relationship means that, by studying dogs, we may also learn much about human cognition.

“Overall. the story of dog cognitive evolution seems to be one about cognitive capacities shaped for a close cooperative relationship with humans, Santos says. “Because dogs were shaped to pick up on human cues, our lab uses dogs as a comparison group to test what's unique about human social learning.” For example, a recent Yale study found that while dogs and children react to the same social cues, dogs were actually better at determining which actions were strictly necessary to solve a problem, like retrieving food from a container, and ignoring extraneous “bad advice.” Human kids tended to mimic all of their elders’ actions, suggesting that their learning had a different goal than their canine companions’.

We may never know the exact story of how the first dogs and humans joined forces, but dogs have undoubtedly helped us in countless ways over the years. Still, only now may we be realizing that by studying them, they can help us to better understand ourselves.