It’s a question of history that lead to their independence. The Vatican, for example, used to be a much larger state that ruled over most of Central Italy until the Italian Wars of Unification dismantled their empire piece by piece, leaving the Pope besieged in Vatican until they signed the Lateran Treaty in 1929, with both countries recognizing each other’s existence.
Similarly, Singapore used to be a part of the British Empire then of the Malaysian Federation before they split due to political tension.
Latest Answers