Law is the set of rules a society develops and enforces to ensure peace and social relationships and punish people who break them. It also includes the system of rights and duties a person is expected to follow in their interactions with others: for example, threatening or abusive phone calls are against the law. Laws can be general or specific, ranging from the rules that govern aviation to the laws of property. Laws are often based on principles, analogies and statements made by judges in previous cases or by the king’s lawyers. A judge’s decisions form the common law, which is what most legal systems are based on, and the reasons given in the decision are often more important than the outcome of the case itself.

In many countries, the laws vary between different jurisdictions and from time to time. They are influenced by the political environment in which they are created and, in turn, shape politics, economics, history and society in various ways. A country’s constitution, written or tacit, may also dictate some of its laws, especially with respect to a country’s power structure. In addition to these laws, a country may have a body of statutes, which are laws passed by the legislative branch of the government.

Generally, there are four key functions of law: establishing standards, maintaining order, resolving disputes and protecting liberties and rights. The way in which a country’s law is established and enforced is dependent on a variety of factors, including the size and complexity of the nation-state; the degree to which it is a democracy; the political culture; and whether there are strong checks and balances within the judicial system.

The nature of a country’s law is also determined to some extent by the philosophy and philosophical beliefs of its citizens. Utilitarian philosopher Jeremy Bentham’s definition of law was that it consists of “commands, backed by the threat of sanctions, from a sovereign to which people have a habit of obedience”. The natural law theorists, such as Jean-Jacques Rousseau and Thomas Aquinas, believed that the laws of nature and of God were immutable and unchanging.

There are many types of law, but the main categories are criminal law (including terrorism and war crimes); contract law; family law, covering marriage, divorce and custody of children; and administrative and constitutional law. Laws concerning the environment, international relations, transport and communications are also significant. A wide range of other specialisms exist, such as e-commerce law; intellectual property law; and biolaw, which is the intersection of law and the life sciences.