Police weren't invented until the 1800's. So how were criminals caught in Medieval times, and how can you use that to your advantage in your tabletop RPG?
Note: This is a general example of historical practice. Actual practices varied by region and over time. Offer void where prohibited.
In Medieval England, every 12-year-old boy went through a coming-of-age ceremony in front of the local bailiff (more on the bailiff in another post), in which four things happened:
First, the boy was placed in a "tithing," which was group of roughly 10 to 20 adults that lived close to that boy. The term originally came from the term for "1 in 10," but in practice things weren't that neatly divisible.
Second, the boy swore that if he witnessed any crime committed by or against anyone in his tithing, he would report it to the bailiff. If he didn't, everyone in the tithing would be fined.
Third, the boy swore that if he witnessed any crime at all, he would raise the "hue and cry," a special shout that alerted everyone nearby of a crime. If he didn't, he would be fined.
Fourth, the boy swore that if he heard the hue and cry, he would run towards it and capture the perpetrator. If he didn't, he would be fined.
This created a very effective incentive for everyone to get involved when a crime was committed. You didn't need a separate police force; people policed themselves. And it became hard to form a gang within a town; you either had to convince all 10 to 20 people in your tithing or be very good at keeping secrets.
For those wondering about abuse: if you did any of this falsely, you'd be fined. There were a lot of fines.
How to Use This In a Fantasy RPG
If the PCs decide to cause a ruckus in a village, the nearest NPC should raise the hue and cry. Every nearby villager should then swarm the PCs, grapple them to the ground, and tie them up. Later that day, have them brought into the local hall, manor house, or castle and in front of the bailiff; he'll elect an impromptu jury and hold a quick trial. The trial should be reasonably fair, but disturbing the peace is disturbing the peace and will lead to a fine even if "he insulted my mother first."
That said, the bailiff often knows of outlaws and other threats lurking in the lands near the village, and may well approach the PCs after the trial, offering to pay them to deal with those threats. He'd rather spend a little coin to keep adventurers busy outside the village than deal with their shenanigans within it.
Separately, if the PCs threaten an NPC in a village, he or she can retaliate by saying they'll "have to" report this to the bailiff. This raises the stakes for the PCs' actions, which is almost always worthwhile.