Spain would lose all three of its remaining Caribbean colonies by the end of the 1800s. Santo Domingo declared independence in 1821 as the Republic of Spanish Haiti. After unification and then split from the former French colony of Haiti, the President of the Dominican Republic signed an agreement that revert the country to a Spanish colony in 1861. This triggered the Dominican Restoration War, which resulted in the Dominican Republic's second independence from Spain in 1865. Cuba fought for independence from Spain in the Ten Years' War (1868–78) and Little War (1879-80) and finally the Cuban War of Independence (1895–98). American intervention in 1898 became the Spanish–American War and resulted in the United States gaining Puerto Rico, Guam (which are still U.S. territories), and the Philippine Islands in the Pacific Ocean. Under military occupation, Cuba became a U.S. protectorate until its independence in 1902.