Got a mouse in the house? Blame yourself. Not your housekeeping, but your species. Humans never intended to live a mouse-friendly life. But as we moved into a settled life, some animals — including a few unassuming mice — settled in, too. In the process, their species prospered — and took over the world.

The rise and fall of the house mouse’s fortunes followed the stability and instability of the earliest human settlements, a new study shows. By analyzing teeth from ancient mice and comparing the results to modern rodents hanging out near partially settled groups, scientists show that when humans began to settle down, one mouse species seemed to follow. When those people moved on, another species moved in. The findings reveal that human settlement took place long before agriculture began, and that vermin didn’t require a big storehouse of grain to thrive off of us.

Between 15,000 and 11,000 years ago (a time called the Natufian period), people began to form small stone settlements in what is now Israel and Jordan. They were not yet farming or storing grain, but they were living in a single place for a season or two, and coming back to that place relatively often. Those early settlers changed the ecosystem of the world around them — presenting new opportunities for local flora and fauna.

Lior Weissbrod, an archaeologist at the University of Haifa in Israel, started his career wanting to search for clues to the history of animal-human relationships. He was especially interested in animal remains. But, he admits, mouse teeth weren’t exactly his first choice. “[At] the site I was going to work on, the remains of larger animals were already studied,” he says. “I was left with the small mammals.”

Small mammals have even smaller teeth. The largest mouse molars are only about 1 millimeter long. This meant a lot of time sifting dirt through very fine mesh for Weissbrod. He collected 372 mouse teeth from the dirt of five different archaeological sites in modern-day Israel and Jordan, with remains dating from 11,000 to 200,000 years ago. He gave the teeth to his colleague Thomas Cucchi of the National Museum of Natural History in Paris, who developed a technique to classify the mouse teeth by species based on tiny differences in their shape.

The first human settlements were only a few houses, but that’s a seismic shift if you’re the size of a mouse. Before the settlements were built, the mouse species Mus macedonicus scurried through the undergrowth. But after stone buildings arrived, another species dominated — Mus domesticus. When humans left the settlements for about 1,000 years around 12,000 years ago, the reverse occurred: M. domesticus left and M. macedonicus moved back in.

The two species probably competed against each other when humans were absent, Weissbrod hypothesizes. But when people were around, M. domesticus was better at taking advantage of human presence. They may have had more flexible diets — making it easier to live off our leavings — and less fear of people. “Once you get humans into the picture and human settlements … there’s a creation of a new habitat,” he explains. “This species [M. domesticus] is finally getting a break from the competition.”

Ancient samples alone would not be enough to establish whether one mouse species could out-compete another based on human settlement alone. For a modern approximation of the ancient, partially settled lifestyle, Weissbrod turned to the Maasai, a nomadic cattle-herding group in southern Kenya. “Maasai are nothing like ancient hunter-gatherers,” he notes. “But we look at specific things that make them comparable.” Maasai herders tend to live in small groups, and use those settlements over and over. “The Maasai aren’t sedentary, they are on the verge perhaps,” he explains. “So they move [often] but not to the extent of highly mobile nomadic groups, they move on a seasonal basis.”

Weissbrod headed to Kenya to collect 192 live, spiny mice, living around Maasai settlements. These mice could be divided into two species, Acomys wilsoni — the short-tailed version — and Acomys ignitus, with longer tails. An archaeologist used to working with dry and dusty fossils, Weissbrod had to adjust to working with live, wiggling rodents. “It took a conscious process of pushing myself to get over the ingrained aversion,” he says.

Like their ancient kin, one modern spiny mouse had a competitive advantage when people were present. A. ignites made up 87 percent of the mice caught hanging out with the Maasai, but only 45 percent of the mice in non-settled area.

The associations between mice and men allowed Weissbrod, Cucchi and their colleagues to show how house mice came to live alongside us — no grain or farming required. “We can show with a high degree of certainty now that mice became attached to us 3,000 years before farming,” Weissbrod says. “From that we learned hunter-gatherers were making the transition to sedentary lives before farming. They didn’t need the crops to make that transition.” Weissbrod and his colleagues published their findings March 27 in the Proceedings of the National Academy of Sciences.

“I thought it was wonderful,” Melinda Zeder, an archaeologist at the Smithsonian Institution in Washington, D.C., says of the study. “I really appreciated it on a number of levels.” Zeder said she was impressed that such a big finding could come from samples so incredibly small. “It’s not a keystone or early writing, it’s something most people overlook,” she says. “Out of the mouths of mice, we’re getting a wonderful view of a pivotal time in history.”

Other species certainly took advantage of human settlement, Zeder notes. Wolves and wild boar arrived and “auditioned themselves for a starring role as a domesticate.” A few of the friendlier ones began to interact more with people. Those people began to see the advantages of the animals. From wolves were born dogs, and from wild boar our pigs.

But when humans weren’t paying attention, other species moved in and thrived on their own. Mice aren’t the only vermin that have arrived to, as Weissbrod says, “domesticate themselves.” Sparrows, pigeons, rats and other species have come to take advantage of our presence. We may have never seen a use for them, but that doesn’t stop them from using us.