The Katipunan started the Philippine Revolution in 1896. Internal disputes led to an election in which Bonifacio lost his position and Emilio Aguinaldo was elected as the new leader of the revolution. In 1897, the Pact of Biak-na-Bato brought about the exile of the revolutionary leadership to Hong Kong. In 1898, the Spanish–American War began and reached the Philippines. Aguinaldo returned, resumed the revolution, and declared independence from Spain on June 12, 1898. The First Philippine Republic was established on January 21, 1899.