By the time of the Spanish-American War, the Philippines had been ruled by Spain for centuries. Many Filipinos (including many who were largely of Spanish ancestry) wanted the country to have greater autonomy or even independence. When Spain refused this, a rebellion arose. This rebellion lasted from 1895 to 1897. Its leader, Emilio Aguinaldo, was in exile when the Spanish-American War broke out. He returned to the Philippines at the request of the US government. Once there, however, he expected and hoped for independence. When the US was unwilling to grant independence, Aguinaldo and his supporters fought against the US in a terribly bloody war that lasted roughly 3 years.