The principle that sitting heads of state are immune from prosecution abroad is a longstanding tenet of international law seen as fundamental to diplomacy.