The Federation of Malaya (in Malay: Persekutuan Tanah Melayu) was formed in 1948 from the British settlements of Penang and Malacca and the nine Malay states and replaced the Malayan Union. Within the Federation, while the Malay states were protectorates of the United Kingdom, Penang and Malacca remained British colonial territories.
The Federation achieved independence within the Commonwealth of Nations on August 31, 1957. In 1963, the federation was enlarged to form Malaysia through the admittance of Singapore, Sarawak and British North Borneo, which was renamed Sabah. Singapore separated from Malaysia to become an independent republic in 1965.