Law is a set of rules created and enforced by the state to ensure a society based on freedom and fairness. It is a foundation of any society and can be broken or defied through rebellion or resistance, but the main function of laws is to protect citizens from violence and establish a basic framework for order.

Law is complex and has many definitions and interpretations. The simplest is that law is the imposition of a sovereign authority and the obligation of obedience on the part of all subjects to that authority: a rule or guideline that must be obeyed. This explains why the word is also used as a synonym for government, a description of a political system that gives power to a group of people who have to obey its rules and can punish those who break them.

The most common law is written, and in most countries there are national constitutions or charters that enumerate the rights of the citizens. These documents define a legal system in which an executive or legislative branch of government sets laws, while courts interpret and uphold them. The laws that are enacted are called statutes, and the collection of these is called a code. A well-known example is the United States Code, which is a codification of all laws, including regulations, of the Federal Government. Many states have their own versions, varying slightly from the Federal version.

Some of the laws are complex and technical, while others are largely concerned with social and ethical issues. For example, environmental protection laws seek to penalise polluters within domestic legal systems. Aviation law covers all the regulations and standards relating to piloting and aircraft operation. These are generally aligned with international laws set by the International Civil Aviation Organisation, or ICAO.

Other laws are derived from religion, and a great many religious communities have their own law codes, such as the Jewish Halakha, Islamic Sharia and Christian canon. These are usually based on religious precepts, but can be elaborated by further human elaboration of interpretation and reasoning using concepts such as Qiyas (reasoning by analogy), Ijma (consensus) and precedent.

A large number of laws govern all kinds of specific activities, such as banking, military activity, criminal justice, labour or property. Many of these laws are influenced by international laws, such as those on copyrights or patents. Some are based on economic factors, such as the price of oil and other natural resources, which can change quickly and require laws to adapt. The law can also be a powerful force for social restriction, such as censorship, criminal punishment and the police. Articles that deal with the relationship between law and other aspects of the political system are constitutional; ideology; political party; and political system. The law is also an important component of a society, and articles that describe the institutions, community and relationships that form its basis are civil society; censorship; crime and punishment; and government.