Justice, in its broadest sense, is the principle that people receive that which they deserve, with the interpretation of what then constitutes "deserving" being impacted upon by numerous fields, with many differing viewpoints and perspectives, including the concepts of moral correctness based on ethics, rationality, law, religion, equity and fairness. The state will sometimes endeavour to increase justice by operating courts and enforcing their rulings.
Consequently, the application of justice differs in every culture. Early theories of justice were set out by the Ancient Greek philosophers Plato in his work The Republic, and Aristotle in his Nicomachean Ethics. Throughout history various theories have been established. Advocates of divine command theory have said that justice issues from God. In the 1600s, philosophers such as John Locke said that justice derives from natural law. Social contract theory said that justice is derived from the mutual agreement of everyone. In the 1800s, utilitarian philosophers such as John Stuart Mill said that justice is based on the best outcomes for the greatest number of people. Theories of distributive justice study what is to be distributed, between whom they are to be distributed, and what is the proper distribution. Egalitarians have said that justice can only exist within the coordinates of equality. John Rawls used a social contract theory to say that justice, and especially distributive justice, is a form of fairness. Robert Nozick and others said that property rights, also within the realm of distributive justice and natural law, maximizes the overall wealth of an economic system. Theories of retributive justice say that wrongdoing should be punished to insure justice. The closely related restorative justice (also sometimes called "reparative justice") is an approach to justice that focuses on the needs of victims and offenders.