Laws in Mesopotamia date back to 2250 BC, but the actual contents are not known in great details as they were not properly preserved. The only detail we have is from the time of Neo-Babylonian period dating from the Akkadian times. The best known laws were that of King Hammurabi, who reigned from 1792-1750 BC. They were inscribed on a stone stela and placed in various temples.
In the stela, Hammurabi was placed just before the sun god Shamash, who was regarded as the deliverer of justice in ancient Mesopotamia. Ancient Mesopotamian belief revolved around god and the people believed laws emanated from him only.
It was believed that the sun god gave all powers to King Hammurabi and entrusted him with the ring and rod, which were symbols of divine justice and kingship.
King enacted god's laws:
The king acted as the guardian and ensured people followed the edicts laid down by god. There is also an epilogue on the stela which says the king was not only the protector, but also brought peace and justice after military conquests.
He was regarded as a ruler who could only ensure peace. These were publicly viewed and the emperor made sure the people understood he was righteous and symbolized justice. It was also a template for future rulers.
Laws of Mesopotamia were just for the times. Compared to other civilizations, Mesopotamia was rich in culture and there was a semblance of good governance which, rubbed on other civilizations as well. An example would give an idea of the kind of laws in Mesopotamia. If a land was rented out to a farmer, he could enjoy deductions in payment in the event of floods or natural calamities.
But the king was the supreme authority and always wielded enormous power. If a fisherman or an overseer was ordered up by the king and he failed to turn up or sent a hireling, there was every chance he would have been put to death and ended up losing his property. But those were tough times and ancient as well and the laws of Mesopotamia were comparatively just.