Immunity from prosecution is a doctrine of international law that allows an accused to avoid prosecution for criminal offences. Immunities are of two types. The first is functional immunity, or immunity ratione materiae. This is an immunity granted to people who perform certain functions of state. The second is personal immunity, or immunity ratione personae. This is an immunity granted to certain officials because of the office they hold, rather than in relation to the act they have committed.
Functional immunity arises from customary international law and treaty law and confers immunities on those performing acts of state (usually a foreign official). Any person who in performing an act of state commits a criminal offence is immune from prosecution. This is so even after the person ceases to perform acts of state. Thus it is a type of immunity limited in the acts to which it attaches (acts of state) but will only end if the state itself ceases to exist. This immunity, though applied to the acts of individuals, is an attribute of a state, and is based on the mutual respect of states for sovereign equality and state dignity. States thus have a significant interest in upholding the principle in international affairs: if a state's officials are to be tried at all for anything, it will be at home.
State offices usually recognised as automatically attracting this immunity are the head of state or head of government, senior cabinet members, ambassadors and the foreign and defence ministers. Many countries have embodied these immunities in domestic law. States regularly assert that every official acting in their official capacity is immune from prosecution by foreign authorities (for non-international crimes) under the doctrine of ratione materiae. Such officers are immune from prosecution for everything they do during their time in office. For example, an English court held that a warrant could not be issued for the arrest of Robert Mugabe on charges of international crimes on the basis that he was a presently serving Head of State at the time the proceedings were brought. Other examples are the attempts to prosecute Fidel Castro in Spain and Jiang Zemin in the USA.