“Color pattern differences are thought to have arisen from mutation and artificial selection during and after domestication from wolves,” Danika Bannasch, a geneticist and co-author of the study says. “But important gaps remain in understanding how these patterns evolved and are genetically controlled.”

Dogs, like most other mammals, acquire their coloring via the expression of their Agouti-signaling protein (ASIP). This gene controls the variation of yellow and black pigments in mammals. The scientists studied the structural variants for this gene at two locations and found that it produces five distinct base colors: dominant yellow, shaded yellow, agouti (wolf gray), black saddle and black back. These five distinctive colors occur in hundreds of dog breeds, with variations of course.

Many people believed that modern dogs’ coloring stemmed from that of the grey wolf. While research shows that this is the case for the agouti coloring, this is not the case for all the base colors. While researching these five base coats, Bannasch and her team determined that the genetic combination for the dominant yellow coat derived from an extinct species of wolf that lived over two million years ago. The observations found that the dominant yellow haplotype was nearly identical to an extinct canid.

“We were initially surprised to discover that white wolves and yellow dogs have an almost identical ASIP DNA configuration,” geneticist and study co-author Chris Kaelin said. “But we were even more surprised when it turned out that a specific DNA configuration is more than two million years old, prior to the emergence of modern wolves as a species.”

The researchers believe that the distinct white coat of these extinct canids allowed them to survive in their arctic environments. These extinct canids roamed the earth during an ice age over two million years ago and their light coloring allowed them to sneak up on their prey. The light coat pattern persisted in the species which evolutionarily led to the coats we see in modern-day wolves and dogs.

“The thing that’s really interesting is the patterns of yellow and black pigment,” Bannasch told Newsweek. “It happens a lot in mixes because they default to those patterns whereas many purebreds are fixed for unique, recessive coat colors that you wouldn’t see in randomly bred dogs. In the random-bred dogs you get back to these color patterns that we see and to me it’s really amazing.”

So while the domestication of dogs came only about 30,000 years ago, we have the evolution of a two-million-year-old species to thank for the dogs we love today.

Update August 16, 6:52 p.m.: This story was updated with comment from study co-author Danika Bannasch.