In the Second World War, the Japanese Army invaded and occupied Malaya , North Borneo, Sarawak , and Singapore for over three years. During this time, ethnic tensions were raised and nationalism grew.  Popular support for independence increased after Malaya was reconquered by Allied forces.  Post-war British plans to unite the administration of Malaya under a single crown colony called the " Malayan Union " met with strong opposition from the Malays , who opposed the weakening of the Malay rulers and the granting of citizenship to the ethnic Chinese . The Malayan Union, established in 1946, and consisting of all the British possessions in the Malay Peninsula with the exception of Singapore , was quickly dissolved and replaced on 1 February 1948 by the Federation of Malaya , which restored the autonomy of the rulers of the Malay states under British protection.  During this time, mostly Chinese rebels under the leadership of the Malayan Communist Party launched guerrilla operations designed to force the British out of Malaya. The Malayan Emergency lasted from 1948 to 1960, and involved a long anti-insurgency campaign by Commonwealth troops in Malaya.  On 31 August 1957, Malaya became an independent member of the Commonwealth of Nations.  After this a plan was put in place to federate Malaya with the crown colonies of North Borneo (which joined as Sabah), Sarawak, and Singapore. The date of federation was planned to be 31 August 1963 so as to coincide with the anniversary of Malayan independence; however, federation was delayed until 16 September 1963 in order for a United Nations survey of support for federation in Sabah and Sarawak, called for by parties opposed to federation including Indonesia 's Sukarno and the Sarawak United Peoples' Party , to be completed.