Even before Shogun Tokugawa Ieyasu unified Japan in the early 17th century, Kyoto and many other Japanese cities had sophisticated law enforcement systems, including a professional police force.
The model followed in larger cities involved a magistrate (or magistrates) at the top of the law-enforcement “food chain.”
Magistrates–always drawn from the noble samurai class–sat at the top of the hierarchy. Their job involved punishing criminals and resolving legal disputes involving artisans, merchants, farmers, and other commoners. (As nobles, samurai families could resort to the magistrates but more commonly resolved their legal disputes on their own–frequently, on the edge of a sword.)
Each magistrate employed a number of assistant magistrates, or yoriki, whose primary job was supervising the “beat cops” known as doshin.
The doshin served many functions, from general peacekeeping in the streets to dispute resolution and arresting criminals. Like modern policemen, doshin were generally overworked and under-appreciated, particularly because they normally came from low-ranking samurai families. Police work was also the last resort for under-talented sons from well-known families–a position with the police, either as yoriki or as a doshin, was a dead-end job, and seen as such. Other samurai looked down on doshin in particular, and many people considered them little more than gangsters on the take. Given that the doshin’s minimal salary required many men to rely on supplemental “gifts” from people under their jurisdiction, this opinion might not be completely undeserved.
That said, there were plenty of honest doshin too.
Most doshin carried a hooked nightstick, known as a jitte, which identified them as policemen when on duty. As samurai, they also had the legal right to wear two swords–the long katana and shorter wakizashi, and many carried these as well as the jitte.
The photo above shows a later form of the jitte, which lacks the hook of the medieval version but still has a blade-guard near the hilt. The bearer could use the blade-guard to trap (and sometimes break) an opponent’s sword.
In addition to use of the jitte, medieval police were also trained in Hojōjutsu, a system of prisoner restraint involving elaborate knots. Medieval Japanese police didn’t bother with handcuffs; instead, prisoners were normally bound and led away with ropes. In many cases, prisoners (especially those of the common classes) were presented bound to the magistrate for trial, and expected to kneel in a bed of white sand while awaiting judgment.
The Japanese justice system, though often brutal by modern standards, evolved fairly early in Japanese history. By the medieval era, magistrates, trial procedures, and the police were firmly-established parts of Japanese culture.