Malaysia has its origins in the Malay kingdoms which, from the 18th century, became subject to the British Empire, along with the British Straits Settlements protectorate. Peninsular Malaysia was unified as the Malayan Union in 1946. Malaya was restructured as the Federation of Malaya in 1948 and achieved independence on 31 August 1957. The independent Malaya united with the then British crown colonies of North Borneo, Sarawak, and Singapore on 16 September 1963 to become Malaysia. In August 1965, Singapore was expelled from the federation and became a separate independent country.