Law is a set of rules decided by a particular state meant for the purpose of keeping the peace and security of society.

Courts or police may enforce this system of rules and punish people who break the laws, such as by paying a fine, or other penalty including jail. In ancient societies, laws were written by leaders, to set out rules on how people can live, work and do business with each other. But many times in history when laws have been on a false basis to benefit few at the expense of society, they have resulted in conflict. To prevent this, in most countries today, laws are written and voted on by groups of politicians in a legislature, such as a parliament or congress, elected (chosen) by the governed peoples. Countries today have a constitution for the overall framework of society and make further laws as needed for matters of detail. Members of society generally have enough freedom within all the legal things they can choose to do. An activity is illegal if it breaks a law or does not follow the laws.

A legal code is a written code of laws that are enforced. This may deal with things like police, courts, or punishments. A lawyer, jurist or attorney is a professional who studies and argues the rules of law. In the United States, there are two kinds of attorneys - "transcriptional" attorneys who write contracts and "litigators" who go to court. In the United Kingdom, these professionals are called solicitors and barristers respectively.

The Rule of Law is the law which says that government can only legally use its power in a way the government and the people agree on. It limits the powers a government has, as agreed in a country's constitution. The Rule of Law prevents dictatorship and protects the rights of the people. When leaders enforce the legal code honestly, even on themselves and their friends, this is an example of the rule of law being followed. "The rule of law", wrote the ancient Greek philosopher Aristotle in 350 BC, "is better than the rule of any individual."

Culture is usually a major source of the principles behind many laws, and people also tend to trust the ideas based on family and social habits. In many countries throughout history, religion and religious books like the Vedas, Bible or the Koran have been a major source of law.

Civil law is the legal system used in most countries around the world today. Civil law is based on legislation that is found in constitutions or statutes passed by government. The secondary part of civil law is the legal approaches that are part of custom. In civil law governments, judges do not generally have much power, and most of the laws and legal precedent are created by Members of Parliament.

Common law is based on the decisions made by judges in past court cases. It comes from England and it became part of almost every country that once belonged to the British Empire, except Malta, Scotland, the U.S. state of Louisiana, and the Canadian province of Quebec. It is also the predominant form of law in the United States, where many laws called statutes are written by Congress, but many more legal rules exist from the decisions of the courts. Common law had its beginnings in the Middle Ages, when King John was forced by his barons to sign a document called the Magna Carta.

Religious law is law based on religious beliefs or books. Examples include the Jewish Halakha, Islamic Sharia, and Christian Canon law.

Until the 1700s, Sharia law was the main legal system throughout the Muslim world. In some Muslim countries such as Saudi Arabia and Iran, the whole legal systems still base their law on Sharia law. Islamic law is often criticised because it often has harsh penalties for crimes. A serious criticism is the judgement of the European Court that "sharia is incompatible with the fundamental principles of democracy".[1][2][3]

The Turkish Refah Party's sharia-based "plurality of legal systems, grounded on religion" was ruled to contravene the European Convention for the Protection of Human Rights and Fundamental Freedoms. The Court decided Refah's plan would "do away with the State's role as the guarantor of individual rights and freedoms" and "infringe the principle of non-discrimination between individuals as regards their enjoyment of public freedoms, which is one of the fundamental principles of democracy".[1]

The history of law is closely connected to the development of human civilizations. Ancient Egyptian law developed in 3000 BC. In 1760 BC King Hammurabi, took ancient Babylonian law and organized it, and had it chiseled in stone for the public to see in the marketplace. These laws became known as the Code of Hammurabi.

The Torah from the Old Testament is an old body of law. It was written around 1280 BC. It has moral rules such as the Ten Commandments, which tell people what things are not permitted. Sometimes people try to change the law. For example, if prostitution is illegal, they try to make it legal.[4]

In democracies, the people in a country usually choose people called politicians to represent them in a legislature. Examples of legislatures include the Houses of Parliament in London, the Congress in Washington, D.C., the Bundestag in Berlin, the Duma in Moscow and the Assemblée nationale in Paris. Most legislatures have two chambers or houses, a 'lower house' and an 'upper house'. To pass legislation, a majority of Members of Parliament must vote for a bill in each house. The legislature is the branch of government that writes laws, and votes on whether they will be approved.

The judiciary is a group of judges who resolve people's disputes and determine whether people who are charged with crimes are guilty. In some jurisdictions the judge does not find guilt or innocence but instead directs a jury, how to interpret facts from a legal perspective, but the jury determines the facts based on evidence presented to them and finds the guilt or innocences of the charged person.  Most countries of common law and civil law systems have a system of appeals courts, up to a supreme authority such as the Supreme Court or the High Court. The highest courts usually have the power to remove laws that are unconstitutional (which go against the constitution).

The executive is the governing center of political authority. In most democratic countries, the executive is elected from people who are in the legislature. This group of elected people is called the cabinet. In France, the US and Russia, the executive branch has a President which exists separately from the legislature.

The executive suggests new laws and deals with other countries. As well, the executive usually controls the military, the police, and the bureaucracy. The executive selects ministers, or secretaries of state to control departments such as the health department or the department of justice.

In many jurisdictions the Head of State does not take part in the day-to-day governance of the jurisdiction and takes a largely ceremonial role. This is the case in many Commonwealth nations where the Head of State, usually a Governor almost exclusively acts "on the advice" of the head of the Executive (e.g. the Prime Minister, First Minister or Premier). The primary legal role of the Head of State in these jurisdictions is to act as a check or balance against the Executive, as the Head of State has the rarely exercised power to dissolve the legislature, call elections and dismiss ministers.

The police enforce the criminal laws by arresting people suspected of breaking the law. Bureaucrats are the government workers and government organizations that do work for the government. Bureaucrats work within a system of rules, and they make their decisions in writing.

Lawyers are people who have learned about laws. Lawyers give people advice about their legal rights and duties and represent people in court. To become a lawyer, a person has to complete a two- or three-year university program at a law school and pass an entrance examination. Lawyers work in law firms, for the government, for companies, or by themselves.

Civil society is the people and groups that are not part of government that try to protect people against human rights abuses and try to protect freedom of speech and other individual rights. Organizations that are part of civil society include political parties, debating clubs, trade unions, human rights organizations, newspapers and charities.

"Corporations are among the organizations that use the legal system to further their goals.  Like the others, they use means such as campaign donations and advertising to persuade people that they are right.  Corporations also engage in commerce and make new things such as automobiles, vaporisers/e-cigarettes, and Unmanned aerial vehicles (i.e. "drones") that the old laws are not well equipped to deal with. Corporations also makes use of a set of rules and regulations to ensure their employees remain loyal to them (usually presented in a legal contract), and that any disobedience towards these rules are considered uncivilized and therefore given grounds for immediate dismissal.