Legal immunity, or immunity from prosecution, is a legal status wherein an individual or entity cannot be held liable for a violation of the law, in order to facilitate societal aims that outweigh the value of imposing liability in such cases. Such legal immunity may be from criminal prosecution, or from civil liability (being subject of lawsuit), or both. The most notable forms of legal immunity are diplomatic immunity, judicial immunity, and witness immunity. One author has described legal immunity as "the obverse of a legal power":
A party has an immunity with respect to some action, object or status, if some other relevant party - in this context, another state or international agency, or citizen or group of citizens - has no (power) right to alter the party's legal standing in point of rights or duties in the specified respect. There is a wide range of legal immunities that may be invoked in the name of the right to rule. In international law, immunities may be created when states assert powers of derogation, as is permitted, for example, from the European Convention on Human Rights "in times of war or other public emergency". Equally familiar examples include the immunities against prosecution granted to representatives (MPs or councillors) and government officials in pursuit of their duties. Such legal immunities may be suspect as potential violations of the rule of law, or regarded as quite proper, as necessary protections for the officers of the state in the rightful pursuit of their duties.
Legal immunities may be subject to criticism because they institute a separate standard of conduct for those who receive them. For example, as one author notes:
In the United Kingdom, some exercises of the royal prerogative, which seems to give the government of the day opportunities for massive and unaccountable discretion, rightly come under suspicion, whereas the immunity from libel proceedings of Members of Parliament speaking in the House, or of persons giving evidence in a court of law, is generally regarded as an acceptable protection against powerful (and wealthy) interests who would otherwise constrain public debate or the administration of justice.
Many forms of immunity are granted to government officials to enable them to carry out their functions without fear of being sued or charged with a crime for so doing:
Grants of immunity are particularly important in intergovernmental relations, where traditions have arisen to prevent the diplomatic representatives of a country from being harassed by their host countries.
Such immunities may be granted by law (statutory or constitutional) or by treaty.
Such immunities may be granted by law or, for witness immunity, by prosecutors or other authorities on a case by case basis, commonly as an agreement with the witnesses.