Humans and canines have been best pals for at least the past 15,000 years. We've been taking them for walkies for at least half that time. And now we have a better idea of what's going on inside their cute, fuzzy little skulls.

A new study on the genetic activity of fox pituitary glands shows how dogs evolved to have lower levels of a common stress hormone, effectively making them more chilled than their wild, lupine relatives.

"Other studies have seen a relationship between tameness and stress responses in animals," says the study's first author Jessica Hekman, a PhD candidate at the University of Illinois.

"In particular, the characteristic reduction in fearfulness of domesticated animals is closely linked to reductions in blood levels of ACTH (adrenocorticotropic hormone), a hormone released by the anterior pituitary gland that, among other things, drives the stress response."

While that much is clear, researchers hadn't mapped the processes behind the changes in activity linking the hypothalamus, pituitary, and adrenal glands. 

To better understand what was going on at a genetic level, Hekman and her team turned to the dog's relative, the fox, and a program that has its roots in Soviet-era genetic research.

For more than half a century, the Institute of Cytology and Genetics in Novosibirsk, Russia, has been breeding foxes in order to study how wild animals become tame.

The breeding program has its origins in the work of a Russian scientist named Dmitry K. Belyaev, who sought to explain the genetics behind the evolution of the modern dog.

Belyaev's legacy are generations of silver foxes, minks, ermines, and rats that have been artificially selected to shape their evolution.

Hekman and her animal sciences supervisor, Anna Kukekova, compared the activity of genes in the pituitaries of six tame foxes with six bred for aggression.

Earlier studies had shown that while ACTH is reduced in the blood of tame foxes compared with their less friendly cousins, there's no difference in the hormone's levels in the pituitary.

"This means that differential expression of the gene encoding ACTH may not cause the differences seen in blood levels of this hormone, and some other mechanism is reducing ACTH in the bloodstream of tame foxes," says Kukekova.

What they did were differences in the expressions of genes that controlled the shapes of cells in the gland.

In other words, while there was no real difference in the production of ACTH itself in either of the fox lines, the way cells in their pituitary gland contorted made all the difference in how they released the hormone.

"Their pituitary glands may produce the same amount of stress hormones but be less efficient at getting those hormones into the bloodstream," says Hekman.

To be clear, there's no single trait that turned the ancestors of modern dogs from dangerous predators into lovable companions.

For instance, another recent study uncovered a chromosomal change that made them friendlier, a shift that has been compared to a genetic disorder in humans that includes characteristics of hypersociability.

A whole bunch of small changes over the millennia have turned virtual wolves into the variety of floppy-eared, short-snouted doggos we love to fawn over today.

Admittedly, not all changes were big wins for the canine, with research also showing dogs probably sacrificed their smarts along the path to domestication.

But teaming up with humans was clearly worth it in the long run, so losing a few IQ points along with the ability to stress out probably didn't count as a significant loss.

This research was published in G3.