Babylonia had three social classes: the awilu, an upper class consisting of free persons; the mushkenu, who were free individuals of low estate and the wardu, who were slaves. Babylonia was ruled by a king, assisted by nobles from the upper class of awilu.
The hierarchy of the Babylonian society is known from contemporary documents, such as the Code of Hammurabi, which provide a comprehensive insight into the way of life of the Sumerians. All inhabitants of the Babylonian cities were free except for the slaves. There were two categories of slaves in Babylonia: debt slaves, who could gain freedom by paying their debt, and foreign slaves, mostly war prisoners, who were not eligible to earn their freedom.