Persons are autonomous beings, capable of making decisions and choices based on their own free will and reason, independent of others, and furthermore being held accountable for the outcomes of their decisions and choices. Social contract theories believe that the moral code is created by the people who form societies. These people come together to create society for the purpose of protection and gaining other benefits of social cooperation. These persons agree to regulate and restrict their conduct to achieve this end. Prior to the creation of society, these people live in the state of nature which is a state of war.
Every person is out for their own purposes and good.
There is no morality in the state of nature. Everyone in the state of nature has the right of nature in which nothing is prohibited which promotes your self-interest. Furthermore there is a law of nature which states that all people act to preserve their own lives, therefore, it is acceptable to do whatever is necessary to protect and defend their lives. This is why the first law of nature is to leave the state of nature. The drive for self-preservation dictates that persons need social relationships for the purpose of protection.