The creation of Hammurabi's Code came about in response to a need for a solid code of law in the the realm of ancient Mesopotamia. It was created by the sixth Babylonian king, named Hammurabi, and put into law certain rules like "an eye for an eye, a tooth for at tooth". This solid and undeniable code of law helped Hammurabi keep control of his kingdom and thus keep it from being vulnerable to outside influences in the region.