Diplomatic Immunity is the principle of international law
which states that envoys
who enjoy the legal status of diplomat
may not be arrested or detained in the country in which they carry out diplomatic activity. Generally, diplomats
carry a special diplomatic passport
and soon after arriving at a foreign posting, they must present their credentials
to the appropriate ministry or department at the host government
Although diplomats have occasionally abused their privileged status, the real reasons for diplomatic immunity are practical. It ensures that diplomats are not harassed or intimidated for political purposes while pursuing their jobs. Diplomats may possess detailed knowledge of a country's negotiating position on a matter of contention. Without diplomatic immunity, diplomats could theoretically be detained and tortured into revealing this information. The granting of diplomatic immunity to envoys working in your country is generally seen as a quid pro quo for guaranteeing the protection of your own diplomats.
One fairly common abuse of diplomatic immunity is the use of it to protect intelligence agents, particularly the highest ranking spy, who is generally referred to as a station chief. They are usually admitted as some lower ranking diplomat, say a consular official, but their real duty is espionage. As all nations follow this practice, granting diplomatic immunity should not be seen as a particular disadvantage.
While diplomats may not be arrested, they may be expelled from the host country for unseemly activities. Such as when one is caught spying. When that happens a diplomat is declared persona non grata and given a short period of time to leave the country, generally 24 to 72 hours. Such expulsions have sometimes been used as diplomatic symbols, particularly during the Cold War.