From 1795 to 1822 the city changed hands several times along with the colony it headed. It was ceded to France in 1795 after years of struggles. However, the French failed to consolidate this cession, mainly because of the continued presence of British troops in Saint-Domingue (they remained until 1798). As the news of Santo Domingo's cession became known on the island, many Dominicans had sided with Britain against France, welcoming British ships into their ports, pledging allegiance to the British in exchange for protection, and enlisting in the military forces of France's nemesis. The city was briefly captured by Haitian rebels in 1801, recovered by France in 1802, and was once again reclaimed by Spain in 1809. In 1821 Santo Domingo became the capital of an independent nation called the Republic of Spanish Haiti after the Criollo bourgeois within the country, led by José Núñez de Cáceres, overthrew the Spanish crown. The nation was conquered by Haiti just two months later. The city and the colony lost much of their Spanish-born peninsular population as a result of these events which caused a great deal of instability and unrest.