Among domestic animals, cats are best known for their independence. With good reason: They have been living alongside humans for far longer than they've been domesticated. Felines lived side by side with humans for thousands of years before we finally began to influence their breeding, according to new research (via Smithsonian). Whereas it has been 40,000-odd years since we started domesticating dogs, selective breeding of cats may have started only in the medieval era.

Writing in Nature Ecology and Evolution, scientists from the University of Leuven in Belgium and the Institut Jacques Monod in Paris (among many other institutions) analyzed cat DNA from ancient and modern cats from Europe, north and east Africa, and southwest Asia, looking at samples dating back 9000 years. They got their samples from the bones and teeth from more than 200 cat remains from Stone Age sites, Viking graves, and Egyptian tombs.

There is plenty of evidence that cats and humans have lived together for millennia, like a cat skeleton buried with a person in Cyprus around 7500 BCE and skeletons of cats buried in an Egyptian cemetery from around 3700 BCE. But the "evidence points to a commensal relationship between cats and humans lasting thousands of years before humans exerted substantial influence on their breeding," they write.

Domestication came in two waves, according to this research. Of five different subspecies of wildcat that originated all over the world, domestic cats only belong to one: Felis silvestris lybica, the African wildcat. When the first farmers in the Fertile Crescent began to store grain from their fields, wildcats flocked to hunt the mice that were attracted to the food stores. Farmers likely began to tame these cats, realizing that they could keep rodents away from the food supply. These cats from the Middle East then started to spread into Europe.

Several thousand years later, ancient Egyptian cats began to spread out across what is now Turkey, Bulgaria, and other places, becoming a more common type than the Middle Eastern cats that had previously dominated the population. Egyptian cats traveled throughout the world thanks to shipping, because boats needed feline sailors to keep rats from chewing through their ropes and eating their food on board. Egyptian cat DNA showed up in samples from as far north as a Viking port on the Baltic Sea, so it's likely that they were taken on trade routes to northern Europe.

Unlike with dogs, though, it seems that people were employing cats as mousers but not selecting specific aesthetic traits. People haven't been breeding cats until quite recently—just about 700 years ago. In order to pinpoint the spread of domestication by humans (which is a contentious thing to define, as house cats are still very similar genetically to their wild cousins), the researchers followed the spread of the genetic change that leads to blotched tabby markings; because the coloration is due to a recessive gene mutation, its proliferation was probably due to humans breeding for that pattern. (It doesn't show up in wildcat populations.) According to the scientists' samples, the allele for this pattern didn't show up until the medieval era, around 1300 CE, when it was present in what is now Turkey. It would take a long time before humans really began choosing their cats for their appearance. Breeding for looks didn't really take off until the 19th century.

Even now, cats are much more like their wild counterparts than dogs are. They may be tame, but thanks to their ability to live in harmony with humans while remaining independent, they've managed to retain many of the physical and genetic characteristics of their wild brethren.

[h/t Smithsonian]