As societies became more urban and cities grew, maintaining security became a major priority for governments. Although threats in the ancient world and late antiquity were seen as external, it was also internal unrest that threatened cities and kingdoms. The development of policing was an important change that allowed cities to become safe enough to grow and prosper, but that history and its origin are complex.
In Mesopotamia and Egypt, but the 3rd millennium BCE, local officials appeared to have been tasked with rounding up criminals and bringing them to justice. The appearance of the first law codes during this time suggest crime was prevalent in cities and as urban places grew we begin to see an enforcement body, entrusted to local government officials, in charge with bringing in criminals and others who might have committed given crimes.
We learn more about the development of policing from ancient Greece. Although the term "police" derives from Greek origins, the concept of a civil force patrolling a city had not developed yet. Rather, the task of keeping relative calm and security in a city was something that was outsourced to slaves or servants who belonged to given officials. The Scythians were an ethnic group that came from Russia and Central Asia; some of these groups settled in Greece and warriors and slaves from these populations began to be used by city magistrates. The magistrates were responsible in using this force but most likely to also spy on the urban population to help maintain government control.