The animals would have carried out a similar function to the cat that caught the rat in the nursery rhyme This Is The House That Jack Built, written millennia later.
Scientists traced evidence of a close relationship between human and cat in the ancient village of Quanhucin, Shaanxi province, where millet cultivation was widespread.
Analysis of bones from at least two cats uncovered at the site showed that they preyed on grain-eating animals, probably rodents.
One of the cats had survived to an old age living in the village, while another had a diet suggesting it had scavenged human food or been fed.
At the same time, remains of an ancient rodent burrow into a grain storage pit, and the rodent-proof design of grain pots indicated that rats and mice posed a serious problem for Quanhucin farmers.
Professor Fiona Marshall from the University of Washington at St Louis, US, said: “At least three different lines of scientific inquiry allow us to tell a story about cat domestication that is reminiscent of the old ‘house that Jack built’ nursery rhyme.
“Our data suggest that cats were attracted to ancient farming villages by small animals, such as rodents that were living on the grain that the farmers grew, ate and stored.
“Results of this study show that the village of Quanhucun was a source of food for the cats 5,300 years ago, and the relationship between humans and cats was commensal, or advantageous for the cats.
“Even if these cats were not yet domesticated, our evidence confirms that they lived in close proximity to farmers, and that the relationship had mutual benefits.”
Cats have lived alongside humans for a very long time, but when and where they were tamed remains a mystery.
Previous evidence suggested they were first domesticated in ancient Egypt, where they were kept some 4,000 years ago.