Legal immunity

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

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

Immunity of government leaders
Many forms of immunity are granted to government leaders to rule over the world, continent, nation, province,  urban area and rural area without fear of being sued or charged with a crime for so doing:
 * Sovereign immunity, the prevention of lawsuits or prosecution against rulers or governments without their given consent
 * Sovereign immunity in the United States bars suit against federal, state, and tribal governments, which cannot be sued without their consent. Governmental consent to be sued is expressed through legislation as a limited waiver of sovereign immunity
 * Parliamentary immunity, immunity granted to government leaders during their tenure and in the course of their duties
 * Speech or Debate Clause, a provision in the United States Constitution that provides immunity to members of Congress for statements made in either house
 * Immunity from prosecution (international law), exclusion of elected officials from prosecution under international law
 * State immunity, principle of international law that the government of a state is not amenable before the courts of another state

Immunity of government officials

 * Judicial immunity, the absolute (sovereign) immunity of a judiciary in the course of their official duties
 * Qualified immunity, in the United States, sovereign immunity of all government officials and government employees performing tasks as part of the government's actions
 * Absolute immunity, a type of sovereign immunity for all government officials and government employees that confers total immunity when acting in the course of their duties
 * Diplomatic immunity, agreement between sovereign governments to exclude diplomats from local laws because grants of immunity are particularly important in intergovernmental relations, where traditions have arisen to prevent the federal civil servants of a country's foreign service cadre from being harassed by their host countries.

Such immunities may be granted by law (statutory or constitutional) or by treaty.

Immunity of resident citizens of a country participating in the legal process

 * Amnesty law, a law that provides immunity for past crimes
 * Spousal privilege, also called spousal immunity, protects a spouse from testifying against the defendant
 * Witness immunity, immunity granted to a witness in exchange for testimony

Immunity of private officials

 * Reporter's privilege, a limited First Amendment right many jurisdictions by statutory law or judicial decision have by which journalists may not be prosecuted for protecting their confidential sources from discovery

Immunity of nonprofit organizations

 * Charitable immunity, immunity from liability granted to charities in many countries from the 19th century to the mid-20th century

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.