Penang was placed under a military administration until 1946, as the British sought to restore order in the face of an emerging Communist insurgency. The British also dissolved the Straits Settlements in April 1946, with Sir Shenton Thomas being its last Governor; Penang and Malacca were then merged with the Federated Malay States and the Unfederated Malay States to form the Malayan Union (the new Colony of Singapore, excluded from this union, was to remain firmly under British rule). The Malayan Union was replaced by the Federation of Malaya in 1948. As the gradual withdrawal of the Western colonial powers in Southeast Asia continued taking shape, the independence of Malaya as a united political entity seemed a foregone conclusion.