The role of government is to protect individual rights. It must ensure that nobody violates the rights of another. In this capacity, it must specify what kinds of actions are forbidden. These rules, punishable by retaliatory force, are called laws. Laws are predefined rules. They are written to make them explicit and verify that they are predefined.
Laws serve multiple purposes. The first is a method of informing the populace of what actions will bring about retaliatory force. This facilitates the job of protecting rights by enabling citizens to have knowledge beforehand whether a particular act is forbidden. The people are then able to act appropriately, removing the need for retaliatory force, and increasing the ability of people to avoid violating others rights.
The second job of a law is to make the rules of the land explicit. This serves to avoid confusion in exactly what is legal or not. Such confusion can occur since the government is an organization of individuals. Individuals that can err or have differences of opinions. It also limits the power of the government officials by requiring them to act according to predefined methods. This has the advantage of safeguarding the people from their own representatives.
A third job of the law is to clarify ambiguous situations between men that may be difficult to decide if rights have been violated, or by who. Even among rational men, disagreement can occur, especially in areas as complicated as contracts. The law provides them a means of settling disputes peacefully by subjecting their claims to an objective, predefined reference. In this respect, the law stands as an impartial arbiter to conflicts.
Laws have many other positive benefits as well, such as providing a reaffirmation that coercive acts will be punished, and justice will be served. To be secure in life and property, man must be able to know what to expect from other people. Although an occasional criminal may act against the rules that govern society, this is exceptional. One interacts in a society because the majority of men act in good faith to respect each other's rights. The law is the primary facilitator for this.