The code was given to Hammurabi by the sun God, Shamash. The Babylonian God, Marduk, facilitated Hammurabi's rule. He gave Hammurabi the authority to rule Babylon. Also, the code gave people moral standards, created distinct social classes, and worked to create equality.