The Principle of Legality is a legal ideal that requires all law to be clear, ascertainable and non-retrospective. It requires decision makers to resolve disputes by applying legal rules that have been declared beforehand, and not to alter the legal situation retrospectively by discretionary departures from established law. It is closely related to legal formalism and the rule of law and can be traced from the writings of Feuerbach, Dicey and Montesquieu.