In South America this is standard practise. El Presidente runs to a friendly embassy during coup. Claims diplomatic asylum, and avoids getting strung up by the mob. The new regime surround the embassy and demand his release for trial. A month later an emissary from the Pope turns up, and quietly negotiates a swift exit to exile in a third country on a private plane.
I don't think many countries outside South America practise diplomatic asylum though. It's not in the Vienna Conventions, so isn't covered by international law.