Immunity confers a status on a person or body that makes that person or body free from otherwise legal obligations such as, for example, liability for damages or punishment for criminal acts. There are various types of immunity, such as judicial immunity , prosecutorial immunity , parliamentary immunity, immunity from prosecution , diplomatic immunity and sovereign immunity.
Sovereign immunity is based on the idea that a sovereign is superior to all in authority and power. It prevents, in advance, a suit or prosecution against a sovereign (being a monarch, ruler, or government as the case may be) without the sovereign's consent.
Judicial immunity, which finds its origin in sovereign immunity, is the absolute immunity of a judge or magistrate from any kind of civil liability for an act performed in the judge's official capacity, i.e. while sitting on the bench the judge cannot be sued for slander if he or she makes a statement about one of the parties before the court that might otherwise be considered slander.
Like judicial immunity, the prosecutor, who is acting under the direction of the sovereign or crown to prosecute cannot be held liable for acts done as an agent of the sovereign. Note how this is distinguished from false arrest.
Parliamentary immunity is granted to elected government officials during their official acts in parliament, congress or other public deliberative organ of government. Such immunity is seen to be a means to the free discussion of ideas, when it is abused there may be ways to surmount such immunity, see for example the biography of Jürgen Möllemann.
Immunity from prosecution occurs when a prosecutor grants immunity to a witness in exchange for testimony. It is immunity because the prosecutor essentially agrees to never prosecute the crime that the witness might have committed in exchange for that testimony.