is a form of legal immunity that ensures diplomats are given safe passage and are considered not susceptible to lawsuit or prosecution under the host country's laws, although they can still be expelled. Modern diplomatic immunity was codified as international law in the Vienna Convention
on Diplomatic Relations (1961) which has been ratified by all but a handful of nations, though the concept and custom of such immunity have a much longer history dating back thousands of years. Many principles of diplomatic immunity are now considered to be customary law. Diplomatic immunity as an institution developed to allow for the maintenance of government relations, including during periods of difficulties and armed conflict. When receiving diplomats, who formally represent the sovereign, the receiving head of state grants certain privileges and immunities
to ensure they may effectively carry out their duties, on the understanding that these are provided on a reciprocal basis.
Originally, these privileges and immunities were granted on a bilateral, ad hoc basis, which led to misunderstandings and conflict, pressure on weaker states, and an inability for other states to judge which party was at fault. An international agreement known as the Vienna Conventions codified the rules and agreements, providing standards and privileges to all states.
It is possible for the official's home country to waive immunity; this tends to happen only when the individual has committed a serious crime, unconnected with their diplomatic role (as opposed to, say, allegations of spying), or has witnessed such a crime. However, many countries refuse to waive immunity as a matter of course
; individuals have no authority to waive their own immunity (except perhaps in cases of defection). Alternatively, the home country may prosecute the individual. If immunity is waived by a government so that a diplomat (or their family members) can be prosecuted, it must be because there is a case to answer and it is in the public interest
to prosecute them. For instance, in 2002, a Colombian diplomat in London was prosecuted for manslaughter, once diplomatic immunity was waived by the Colombian government.