Egypt had one of the first organized governments. Before Upper and Lower Egypt were united, each area was ruled by a king. In 3100 BC, after the country was united into a centralized system of government, it was then divided into 42 nomes, or regions. A governor ruled each region but had to obey the pharaoh.
The pharaoh was the highest authority and had total power over the people. The pharaoh controlled the executive and judicial branches of government and was assisted by many appointed civil servants. When selecting these aides, the pharaoh had to follow the legal rules of seniority and literacy.
Government officials in the Old Kingdom held positions such as the Royal Courtiers, Advisors, Councilors, and Ministers. The Royal Court's status grew over time and covered religious, civil, judicial, and military duties. The Advisor was the highest official in the state, but not a member of the government's higher Council. The Council was comprised of senior state officials who enforced legislation and royal decrees and later assumed judiciary functions. The Minister was the head of the judges.
A number of administrators specialized in handling taxes, finance, public works, and labor distribution on various projects. Egypt was the first country to implement a system for workers in governmental projects such as crafts, industry, agriculture, and construction.
Courts of law existed in all Egyptian regions. Many contracts and papyri about petitions and verdicts prove that there were specific, fixed laws concerning everyday transactions such as inheritance, marriage, grants, wills, land ownership, and other commercial transactions. Everything was recorded and kept in an archive, including wills, title deeds, census lists, orders, tax lists, letters, inventories, regulations, and trial transcripts.
During the Greco-Roman age, the Ptolemaic king took the position of pharaoh and followed the system of central government. Because the priests threatened the invaders' control, the Ptolemies tried to weaken them by stripping the temples of their properties and rights. They later changed their policy and won the priests' support by showing respect to Egyptian beliefs and building more temples. The Ptolemies maintained the country's division into regions with the governor as the head. The governor acquired a military character as the leader of the garrison and its financial administrator. Inside these districts there were exclusive cities for the elite Greek classes to live in, such as Nokratis, Alexandria, and Ptolemia.
When Egypt became a Roman province, the Romans made no changes unless necessary. The Roman emperor became the pharaoh of Egypt and was portrayed in the Egyptian temples wearing the pharaoh's double crown and clothes. The emperor directly managed Egypt's affairs and took the leadership of the Roman Army. A new post was added in the administration which was the chief judge.
After Egypt became an Islamic province, it continued to be governed from abroad. The caliph appointed a ruler who governed Egypt and managed its affairs in the caliph's name.
He supervised collecting "Al-Kharag," which is the tax on agricultural land. Christians and Jews paid taxes and Muslims paid Zakah. The Police Chief was responsible for preserving security and the post official was responsible for the communication between Egypt and the Center of Caliphate.
The prevention of crime and apprehension of criminals was the duty of local officials and police forces. They opened investigations following complaints by citizens
To Polemon, epistates of Kerkeosiris, from Tapentos daughter of Horos, of the same village. An attack was made upon my dwelling by Arsinoe and her son Phatres, who went off with the contract relating to my house and other business documents. Therefore I am seriously ill, being in want of the necessaries of life and bodily ... P. Tebtunis 52 , fragmentary 114 BCE
They collected clues against suspects by interrogating them and their acquaintances, checking public records, organizing reenactments and applying physical coercion, generally in the form of beatings.
Then, as is still the fact today, most crime was of the petty variety, but in a society where most people lived much closer to the edge of abject poverty, even small thefts might be a serious matter. One such memorandum describes robberies
perpetrated by the workmen of Nakhu-m-Maut. They went into my house, stole two large loaves and three cakes, spilt my oil, opened my bin containing the corn, stole Northern dehu-corn. They went to the house in the wharf, stole half the killesteis (a kind of acid bread) yesterday [baked], spilt the oil.In the third month of the Shemu-season, the 12th day, during the crown feast of king Amen-hotep, l.h.s., they went to the granary, stole three great loaves, eight sabu-cakes of Rohusu berries ..... They drew a bottle of beer which was [cooling] in water, while I was staying in my father's room. My Lord, let whatsoever has been stolen be given back to me... Egyptian publications of MarietteG. Maspero, Etudes de mythologie et d'archéologie égyptiennes vol. 3, 1898
Better connected people might petition regional officials or even the king himself
To King Ptolemy and Queen Cleopatra, his sister, the mother-loving gods, greeting. From Petesouchos son of Petos, Crown cultivator from the village of Oxyrhyncha in the division of Polemon in the Arsinoite nome. I live in Kerkeosiris in the said nome, and there belongs to me in the aforesaid village of Oxyrhyncha a house inherited from my father, possessed by him for the period of his lifetime and by myself after his decease up to the present time with no dispute. But Stratonike daughter of Ptolemaios, an inhabitant of Krokodilonpolis in the aforementioned nome, mischievously wishing to practise extortion on me, coming with other persons against the aforesaid house, forces her way in before any judgement has been given and ... in the village about ... the house, coming in and laying claim to it wrongfully. I therefore pray you, mighty gods, if you see fit, to send my petition to Menekrates, archisomatophylax (archbodyguard) and strategos (commander), so that he may order Stratonike not to force her ways into the house, but, if she thinks she has a grievance, to get redress from me in the proper manner. If this is done, I shall have received succour. Farewell... P. Tebt. 771 From the middle of the second century BCE
Armed with staffs, policemen guarded public places, at times making use of dogs or, probably more rarely, of trained monkeys.
The Criminals and their Crimes:
Although there were differences in how members of the various social classes were treated and judged, neither riches nor nobility raised a person above the law. High treason committed by powerful noblemen and officials was harshly dealt with. Judges and tax collectors abused their powers, above all during times of unrest, and scribes sometimes falsified cadastral data; if they were caught, their punishment could be savage.
As the existence and proper functioning of the state depended on their activities, resisting state officials doing their duty or bribing them had to be suppressed at any cost, as had perjury, false accusations and statements and undue influence on judicial procedure. Misbehaviour had to be punished, honour upheld, peace between neighbours kept, and people's lives and property protected. Not reporting a felony was a crime in itself:
The great criminal, Weren, who was butler.He was brought in because of his hearing the words from the chief of the chamber, and when he had [withdrawn from] him he concealed them and did not report them. He was placed before the nobles of the court of examination; they found him guilty; they brought his punishment upon him... Records of the Harem Conspiracy against Ramses IIIJames Henry Breasted Ancient Records of Egypt, Part Four, § 437
Sacrilege and lese-majesty, twin crimes in a society where the divine and secular were closely interwoven, were especially heinous. They were offenses against what we would see as the worldly institutions of state and king, but in the eyes of the ancient Egyptians rather insults against the gods and the world order they had instituted.
We know of a few, apparently rare attempts on a king's life , but there were also lesser transgressions: The pseudepigraphical Famine Stela threatens the impious with He who spits (on it - i.e. on the stela in the temple) deceitfully shall be given over to punishment. Even if this account is fictitious we may suppose that such actions were prosecuted. Robbery, theft and the fencing of stolen goods were criminal offences, particularly the breaking, damaging and looting of tombs:
After collaborating for four years, Amenpenofer, a builder working for Amenhotep, High Priest of Amen-Re Sonter, and seven other builders, woodworkers, farmers and a boatman, decided to break into the pyramid of Sobekmesef. With their metal tools they cut a passage into the pyramid's underground chambers, removed all the obstacles and reached the sarcophagi of the queen and king. They opened the lids and the inner gilded wooden coffins, collected the golden face masks, jewellery, amulets, weighing 160 deben (about 14.5 kg) and burned the remains. They divided the loot into eight parts and were rowed back over the Nile by the boatman.
Whether he couldn't keep quiet, his sudden wealth was noticed, or they had been observed, Amenpenofer was arrested by the city guards and brought to the office of Peser, prince of the city. He bribed a scribe with his twenty deben of gold and was released without being charged. On his return, his associates agreed to redistributing the remaining 140 deben of gold.
The robbers returned with the investigating judges to the pyramids they had robbed. They agreed to reveal all the names of the gang to their master, the High Priest of Amen, but when they were brought before him, only three of the eight were left. The judges requested of the High Priest to apprehend the fugitives.
The mother of Amenpenofer was exiled to Nubia and the builder himself rearrested a few months later and brought to court.
Not just common people committed tomb robberies. Times were difficult during the late Ramesside period. The administration was in disarray and salaries rarely paid on time, if at all. Social upheaval and civil war brought with them sharp price rises. It is no wonder that scribes and priests took part as well in this "redistribution of wealth".
One such gang included a priest named Pen-un-heb, and four Holy Fathers of the God, Meri and his son Peisem, Semdi and Pehru. They began by stealing the golden necklace of a statue of Osiremire Sotepenre, which after melting left them with four deben and six kit of gold. The old Meri divided the loot among them.
Another gang of priests, scribes and herdsmen robbed the House of Gold of Osiremire Sotepenre. The priest Kaw-karui and four of his colleagues occasionally removed some gold with which they bought grain in town. A herdsman after threatening the priests, received a bull they had bought for five kit (about 45 grammes) of gold. A scribe, Seti-mose, who overheard their quarrel, blackmailed them and extorted four and a half kit of gold.
Justice, represented by Maat , the goddess of the World Order, lay with the gods and was immanent and retributive, both in the here-after  as in this world. The pharaohs as living gods were the source and executors of justice . The administrative tools for achieving justice among humans were the laws and ordinances.
Thou art Re, thy body is his body. There has been no ruler like thee, (for) thou art unique, like the son of Osiris, thou hast achieved the like of his designs Isis [hath not loved] a king since Re, except thee and her [son]; greater is that which thou hast done than that which he did when he ruled after Osiris. The laws of the land proceed according to his position.....
During the Old Kingdom there were seemingly no professional judges. Cases were tried before tribunals of scribes and priests appointed for the purpose, with high officials - sometimes one or even both of the viziers  - presiding. Throughout pharaonic history, the justice system remained part of the executive; and many official positions had executive and judicial aspects.
The title of judge was of great significance to its holder. In the tomb of Mehu, a fifth dynasty judge, inscriptions describe him as zAb (judge), Priest of Maat, the Goddess of Truth, Eldest One of the Hall and Secretary of the Secret Decisions of the Great Judgment Court.
Judging became a profession  and similar to other professions in Egypt, administering the law ran in families. The father was followed by the son unless something extraordinary happened.
The differences between the administration of civil and criminal law were significant. In criminal cases, where the state was the prosecutor, there seems to have been an initial presumption of guilt, and trials were conducted accordingly . Crimes against the state, the king, the gods, and against the person, such as murder and bodily harm, were prosecuted by the state, while victims of robbery, theft, and apparently sexual aggression had to bring their cases before the court themselves .