Law is a framework for regulating and controlling behaviour, whether by a government or by private individuals and groups. Its rules can be created by a collective legislature, resulting in statutes, or by the executive, through decrees and regulations, or by judges in common law jurisdictions who use precedent to build a body of case law. In addition to governing behaviour, law sets standards, keeps order, resolves disputes and protects liberties and rights. Different legal systems are better or worse at these various tasks. For example, a military-backed dictatorship may keep the peace and maintain the status quo but oppress minorities and restrict social change; in contrast, democratic governments tend to promote civil liberty but may be inefficient at keeping the economy running smoothly.

The study of law is diverse, touching on a wide variety of subjects in the humanities and sciences. It can include an examination of historical and cultural traditions, political philosophy and economic analysis. The study of law can also raise issues concerning equality, fairness and justice. Some laws are explicitly based on religious precepts (e.g. Jewish Halakha and Islamic Sharia).

There are three broad categories of law: criminal, administrative and civil. These are subdivided into various fields, including contract; tort; labour and property. For example, contract law encompasses agreements between people and regulates what can be sold or transferred; tort law covers damages for wrongful injury to an individual or their property (whether it be the injuries suffered in a car accident or defamation); and administrative law involves the administration of government (such as censorship or the granting of visas).

The rule of law is a principle that requires public institutions and entities, and the government itself, to abide by laws which are clear, publicly promulgated, equally enforced and independently adjudicated and consistent with international human rights standards and norms. It also requires accountability, participation in decision-making, legal certainty, avoidance of arbitrariness and separation of powers.

The vast majority of nations in the world have civil law traditions. These are rooted in Roman law, which underwent major codification during the reigns of Theodosius II and Justinian I, but later developed into a more flexible system when it was rediscovered by late medieval Western Europe. Some former colonies of European countries, such as Egypt or South Africa, retain much of this tradition. In countries which were once colonised by the European empires, the civil law traditions were often mixed with common law. Moreover, modern legal developments such as globalisation have blurred the distinction between civil and common law.