Diplomatic immunity is a principle of international law by which certain foreign government officials are recognized as having legal immunity from the jurisdiction of another country. It allows diplomats safe passage and freedom of travel in a host country and accords almost total protection from local lawsuits and prosecution.
Diplomatic immunity is one of the oldest and most widespread practices in international relations; most civilizations since antiquity have granted some degree of special status to foreign envoys and messengers. It is designed to facilitate relations between states by allowing their respective representatives to conduct their duties freely and safely, even during periods of political tension and armed conflict. Moreover, such protections are generally understood to be reciprocal and therefore mutually beneficial.
As a longstanding and nearly universal concept, diplomatic immunity has long been considered customary law; however, it was traditionally granted on a bilateral, ad hoc basis, leading varying and sometimes conflicting standards of protection. Modern practices of diplomatic immunity have largely conformed to the 1961 Vienna Convention on Diplomatic Relations, which formally codified the legal and political status of diplomats, and has been ratified by the vast majority of sovereign states.
Contrary to popular belief, diplomats are not entirely immune from the jurisdiction of their host country. Like most foreign persons, they may still be declared persona non grata and expelled. A foreign official's home country may waive immunity, typically in the event that they are involved in some manner in a serious crime unrelated their diplomatic role (as opposed to, for example, allegations of spying). However, many countries refuse to waive immunity as a matter of course, and diplomats have no authority to waive their own immunity (except perhaps in cases of defection). Alternatively, the home country may prosecute the individual on its own accord or through the insistence of the host country.