Hammurabi, first ruler of the Babylonian empire, holds the claim of restoring order and justice to Mesopotamia. Although Hammurabi did conquer other city-states to expand his empire, he let the rulers of the cities-states live and justly ruled the people with fair laws. Hammurabi wanted his subjects to obey him because they liked him and believed he made just, fair laws and not because they were apprehensive of his formidable military.
In Hammurabi's court, it did not matter if you were rich or poor. If you broke the law, and were found guilty, you would be punished. Since the laws were clearly written down, everyone was expected to obey them.
Hammurabi was very concerned to do things that would bring everyone in his empire together, and make them all feel like they were part of this new project together. One thing he did was to issue a law code that would be the same for all the people in the Babylonian Empire. This is called the Code of Hammurabi, and we still have copies of it: there is a picture of it here, showing Hammurabi at the top (standing) and getting the laws from the god (sitting down).
The actual laws range from public to private matters, with humane approaches to human problems. The laws include almost everything: marriage and family relations; negligence; fraud; commercial contracts; duties of public officials; property and inheritance; crimes and punishments; techniques of legal procedure; protection for women, children, and slaves; fairness in commercial exchanges; protection of property; and the list goes on to explain, in detail, each and every one of these instances.
The Code did not merely embody contemporary custom or conserve ancient law. It is true that centuries of law-abiding and litigious habitude had accumulated in the temple archives of each city vast stores of precedent in ancient deeds and the records of judicial decisions, and that intercourse had assimilated city custom.
The universal habit of writing and perpetual recourse to written contract even more modified primitive custom and ancient precedent. Provided the parties could agree, the Code left them free to contract as a rule. Their deed of agreement was drawn up in the temple by a notary public, and confirmed by an oath "by god and the king."
The code of laws applies to the entire Babylonian society. The penalties of the code varied according to the status of the victim. There were three classes in the Babylonian society: the patrician, who were the free men and women; the plebeians, who were the commoners; and the slaves. While the patricians were protected by the law of retaliation, the lower classes received only monetary compensation.