Law is a set of rules decided by a particular place or authority 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 - "transactional" 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.

Types of law 
Medical law is the body of laws concerning the rights and responsibilities of medical professionals and their patients. The main areas of focus for medical law include confidentiality, negligence and other torts related to medical treatment (especially medical malpractice), and criminal law and ethics.
Physician-Patient Privilege protects the patient's private conversations with a medical physician (doctor), this also extends to their personal information (like their contact details) shared with medical personnel.
 Property law states the rights and obligations that a person has when they buy, sell, or rent homes and land (called real property or realty), and objects (called personal property).
 Intellectual property (IP) law involves the rights people have over things they create, such as art, music, and literature. This is called copyright. It also protects inventions that people make, by a kind of law called patent. It also covers the rights people have to the names of a company or a distinctive mark or logo. This is called trademark.
 Trust law (business Law) sets out the rules for money that is put into an investment, such as pension funds that people save up for their retirement. It involves many different types of law, including administrative and property law.
Tort law helps people to make claims for compensation (repayment) when someone hurts them or hurts their property.
Criminal law is used by the government to prevent people from breaking laws, and punish people who do break them.
Constitutional law deals with the important rights of the government, and its relationship with the people. It mainly involves the interpretation of a constitution, including things like the Separation of powers of the different branches of government.
A court order is an official proclamation by a judge that defines and authorizes the carrying out of certain steps for one or more parties to a case.
Administrative law is used by ordinary citizens who want to challenge decisions made by governments. It also involves things like regulations, and the operation of the administrative agencies. 
International law is used to set out rules on how countries can act in areas such as trade, the environment, or military action. The Geneva Conventions on the conduct of war and the Roerich Pact are examples of international law.
Custom and tradition are practices that are widely adopted and agreed upon in a society, thought often not in a written form. Custom and tradition can be enforced in courts and are sometimes considered as part of the legal reasoning in matters decided in courts. In some societies and cultures all law is or was custom and tradition, though this is increasingly rare although there are some parts of the world where custom tradition are still binding or even the predominant form of law, for example tribal lands or failed states.

Civil law and common 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 
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".

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".

History of law 
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.

Legislature 
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.

Judiciary 
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).

Executive (government) and Head of State 
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.

Other parts of the legal system 
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.

Related pages 
Constitution
Death penalty
Ethics
Legal rights
Parliament
 Physical law
 Political economy

Further reading 
H.L.A. Hart, The Concept of Law, (Penelope A. Bullock & Joseph Raz eds. 2nd ed. 1994) (1961).
Sandro Nielsen: The Bilingual LSP Dictionary. Principles and Practice for Legal Language. Benjamins 1994.
A Companion to Contemporary Political Philosophy. edited by Robert E. Goodin and Philip Pettit. .
Johnson, Alan (1995). The Blackwell Dictionary of Sociology. Blackwells publishers. .
Handbook of Political Institutions. edited by R. A. W. Rhodes, Sarah A. Binder and Bert A. Rockman. Oxford University Press. 
An Introduction to IP Law. edited by John Watts. Oxford University Press. Available at Patent Professionals LLC

References

Other websites 
 Law -Citizendium