The Philippine Islands became a Spanish colony during the 16th century; they were ceded to the US in 1898 following the Spanish-American War. In 1935 the Philippines became a self-governing commonwealth. Manuel QUEZON was elected President and was tasked with preparing the country for independence after a 10-year transition. In 1942 the islands fell under Japanese occupation during WWII, and US forces and Filipinos fought together during 1944-45 to regain control. On 4 July 1946 the Philippines attained their independence. The 21-year rule of Ferdinand MARCOS ended in 1986, when a widespread popular rebellion forced him into exile and installed Corazon AQUINO as president. Her presidency was hampered by several coup attempts, which prevented a return to full political stability and economic development. Fidel RAMOS was elected president in 1992 and his administration was marked by greater stability and progress on economic reforms. In 1992, the US closed its last military bases on the islands. Joseph ESTRADA was elected president in 1998, but was succeeded by his vice-president, Gloria MACAPAGAL-ARROYO, in January 2001 after ESTRADA's stormy impeachment trial on corruption charges broke down and widespread demonstrations led to his ouster. MACAPAGAL-ARROYO was elected to a six-year term in May 2004. The Philippine Government faces threats from armed communist insurgencies and from Muslim separatists in the south.