Throughout the history of criminal justice, evolving forms of punishment, added rights for offenders and victims, and policing reforms have reflected changing customs, political ideals, and economic conditions.

Background Primates often have notions of fairness and sharing, with violations punished by exclusion or banishment from social groups. In human history, prior to agriculture, more nomadic cultures had systems of punishment for behavior or resistance. With the development of agriculture, which led to more closely populated cities and cultures and behavior to address fears of persons taking advantage of or causing harm to others, more formal systems of punishment for crimes developed, independently around the world, or based upon other cultures, including those developed in the early Babylonian laws of Hammurabi and the Hammurabic Code.

Medieval Middle East

A police force called the shurta was "an urban force for the suppression of crime" that originated as a branch of the military. They were responsible for dealing with brigands and allegedly rebels as well as exercising judicial functions (often in rivalry with the qadi).

The muhtasib was responsible for enforcing laws on markets, Islamic morality and sumptuary laws for dhimmis.

Ancient Egypt In Ancient Egypt a police force was created by the time of the Fifth Dynasty (25th – 24th century BC). The guards, chosen by kings and nobles from among the military and ex-military, were tasked with apprehending criminals and protecting caravans, public places and border forts before the creation of a standing army. The police used lethal and non-lethal tools (such as wooden staffs) and utilized monkeys and dogs.

During the reign of Amenemhat I (1991 BC – 1962 BC) the role of professional judges were established and employed to decide court cases. The police force was specifically focused on law enforcement, while a newly created standing military was utilized to fulfill the police's other, previous tasks.

Ancient China Law enforcement in Ancient China was carried out by "prefects". The notion of a "prefect" in China has existed for thousands of years. The prefecture system developed in both the Chu and Jin kingdoms of the Spring and Autumn period. In Jin, dozens of prefects were spread across the state, each having a limited authority and employment period.

In Ancient China, under the rule of Dang Lin Wang, a new judicial system emerged. This new system had prefects appointed by local magistrates, who in turn were appointed by the head of state, usually the emperor of the dynasty. The prefects oversaw the civil administration of their "prefecture", or jurisdiction.

Prefects usually reported to the local magistrate, just as modern police report to judges. Under each prefect were "subprefects" who helped collectively with law enforcement of the area. Some prefects were responsible for handling investigations, much like modern police detectives.

Eventually the concept of the "prefecture system" would spread to other cultures such as Korea and Japan. Law enforcement in Ancient China was also relatively progressive, allowing for female prefects. Some examples of ancient Chinese prefects include: Chong Fu, prefect of the Ying District in the East Han Dynasty, and Ching Chow, prefect of the modern Shang-tung Province. An example of a female prefect would be Lady Qu of Wuding (serving 1531 – c. 1557).

In ancient China, when minor judicial incidents such as robberies occur, the client reports to a police officer (a.k.a. constable) at the prefectural office. To catch a thief, a constable can arrest another thief by baiting him with a forged opportunity and use the thief's same-field knowledge to predict the one in question. The assisting thief would still be punished for robbery but since he assisted the officer his punishment would be lowered.

By Ming law, police officers have a strict time schedule to arrest the criminals. They usually have thirty days to arrest the issued criminals. If officers have not capture their assigned criminals after thirty days or assigned deadline, they would subject to physical punishments. Successfully arresting criminals earns police officers promotions. However, this method was often subject to abuse in order to quickly earn promotions.

Police officers were appointed by the head officials from the populations. These selected officers, however, were not recognized as part of the magistrates for they were merely runners.

Approximately one out of four court cases featured corrupted officers who accepted bribes to ignore certain crimes, or sometimes even assisted the criminals. Officers often focused on building a social network which might include criminals instead of making examples by preventing crimes.

Songhai Empire

Pre-modern Europe For the most part, crime was viewed as a private matter in Ancient Greece and Rome. Even with offenses as serious as murder, justice was the prerogative of the victim's family and private war or vendetta the means of protection against criminality. Publicly owned slaves were used by magistrates as police in Ancient Greece. In Athens, a group of 300 Scythian slaves was used to guard public meetings to keep order and for crowd control, and also assisted with dealing with criminals, manhandling prisoners, and making arrests. Other duties associated with modern policing, such as investigating crimes, were left to the citizens themselves. The Roman Empire had a reasonably effective law enforcement system until the decline of the empire, though there was never an actual police force in the city of Rome. When under the reign of Augustus the capital had grown to almost one million inhabitants, he created 14 wards, which were protected by seven squads of 1,000 men. If necessary, they might have called on the Praetorian Guard for assistance. Beginning in the 5th century, policing became a function of clan chiefs and heads of state.

During the Middle Ages, crime and punishment were dealt with through blood feuds (or trial by ordeal) between the parties. Payment to the victim (or their family), known as wergild, was another common punishment, including for violent crimes. For those who could not afford to buy their way out of punishment, harsh penalties included various forms of corporal punishment. These included mutilation, whipping, branding, and flogging, as well as execution. Västgötalagen specifies exactly how much to pay, if anything, depending on who was slain. The primary form of state-administered punishment during ancient times and the Middle Ages was banishment or exile. Though a prison, Le Stinche, existed as early as the 14th century in Florence, incarceration was not widely used until the 19th century. Rather, it was used to detain prisoners before trial or for imprisoning people without judicial process.

The Anglo-Saxon system of maintaining public order was a private system of tithings, since the Norman conquest led by a constable, which was based on a social obligation for the good conduct of the others; more common was that local lords and nobles were responsible to maintain order in their lands, and often appointed a constable, sometimes unpaid, to enforce the law.

Colonial America

When early colonists first came to America, they did not include trained lawyers or other law-knowledgeable persons. Many parts of the criminal justice system in colonial America were similar to those in England, France, and the Dutch Republic. Gradually French and Dutch influences disappeared in the islands. What remained was the basic idea many had of the English common law system.

This system was the best-known to 17th-century colonists. The common law system included a set of rules that were used to solve problems in society. It was based on the history of decisions previous judges had made instead of lawmaking codes or laws. This system made a distinction between two basic types of crimes: felonies and misdemeanors. The legal process, mostly for more serious crimes, involved a grand jury, composed of members of the community, which decided whether there was enough evidence for prosecution. However, in these proceedings no district attorneys or public prosecutors were available. The victim of the crime was responsible for instigating the prosecution and financing it. It was these fundamental principles that stuck with the colonists and were used selectively to create a new and unique criminal justice system.

Many factors influenced the colonists’ selection process by which they constructed their approach to criminal justice. As previously mentioned, there were no professional legal experts and few law resources available. This left a lot of room for creativity and mistakes. The colonists were largely left to their own devices concerning the details of their developing criminal justice system. The new environment the colonists encountered in the New World, especially the western frontier, also affected the way the law was shaped. The system was molded to fit the colonists’ needs as they settled further and further west. Vigilantism was an inevitable byproduct of the faults of the development of justice in America. Religion, especially early on in the colonial period, exerted a strong influence on law making. Legal codes, such as the 1648 Book of the General Laws and Liberties of the Massachusetts Bay Colony, contained very strong biblical references, more so than did the ones in England. Although this religious impact was felt most strongly in Puritan colonies, similar ideas were evident among other colonists as well. Many colonial makeshift criminal codes considered lying, idleness, drunkenness, certain sexual offenses, and even bad behavior to be crimes. These moralistic crimes stemmed from the relation of crime to sin and sin to crime. Adding to the religious factor, the colonists held individual liberty in high regard. This later influenced more contemporary criminal codes.

County sheriff

Besides being one of the most important criminal justice officials of the colonial period in America, the county sheriff had other responsibilities. These included collecting taxes, running and supervising elections, and handling any other legal business in the community. With such a workload, sheriffs were usually the most important political figures in the county and represented the governor and the English government. In the criminal justice system of the period, the sheriff acted as a reactive official. His job was to follow up on complaints or information of misconduct from the other citizens. He was paid through a system of fees rather than a set salary which came mostly from tax collecting. This discouraged many sheriffs from concentrating heavily on law enforcement. Such high powers often led to corruption in this field with embezzlement and other irregularities with tax collections and fees.

Judges and magistrates

Judges are also known as magistrates or justices of the peace. Even though a judge held very influential positions in their counties, they were far from the professionals that they are today. They were usually religious or political leaders. The county judge was in charge of the court for the area he presided in and vehemently believed their role in society was to enforce God's will. Their understanding of God's will usually caused colonial justices to seek confessions and repentance from the accused rather than just punishment. The main goal was to bring order back to society. Most of the minor cases in the county only involved the judge while more serious crimes were heard by a court of several judges. The courts met only periodically, slowing down the sentencing of serious crimes.

Colonial courts