Law is the system of rules created and enforced by a government or other authority to govern the behavior of citizens or the members of a group. It can be established by legislative bodies resulting in statutes, by the executive through decrees and regulations, or by judges through precedent (as in common law jurisdictions). The formation of laws may be influenced by a constitution, written or tacit, and by societal rights encoded therein. Religious law may be based on precepts from a religion, such as Jewish Halakha and Islamic Sharia or Christian canon law.
The function of law is to ensure that everyone behaves in a way that does not harm others or themselves and to punish those who do so. It also provides a framework for peaceful resolution of disputes. For example, when two people claim the same piece of land the law can decide which person is the owner and impose penalties if one of them behaves improperly. Law also establishes a set of standards that people can use to judge whether their actions or ideas are ethical or morally wrong. It is a major source of scholarly inquiry in such areas as legal history, philosophy, economic analysis and social science.
The nature of law varies from nation to nation, as it depends on who has political power and how that power is used. Some nations have governments that are benign and benevolent, while others allow dictatorial regimes to oppress minorities or the opposition. Despite these differences, all forms of law serve the same basic functions: to keep peace and order, protect individuals and property, preserve a status quo, and allow for orderly social change.