to the rise of strongmen in the wake of these wars. The defeat of Napoleon at Waterloo in 1815 caused an exodus of French soldiers into Latin America where they joined ranks with the armies of the independence movements. While these officials had a role in various victories such as the Capture of Valdivia (1820) some are held responsible for significant defeats at the hands of the royalist as is the case of Second Battle of Cancha Rayada (1818). In contrast, the Portuguese royal family escaped to Brazil and established the court there, resulting in political stability for Portuguese America. With the defeat of Napoleon and the return of the Braganza monarchy to Portugal, the heir remained in Brazil and declared Brazilian independence, achieving it peacefully with the territory intact. The Haitian Revolution began in 1791, just before the French Revolutionary Wars, and continued until 1804. France's defeat resulted in the independence of Saint-Domingue and led Napoleon to sell the territory making up the Louisiana Purchase to the United States. Barbary Wars During the Napoleonic Wars, the United States, Sweden, and Sicily fought against the Barbary pirates in the Mediterranean. Invasion of Russia, 1812 The Treaty of Tilsit in 1807 resulted in the Anglo–Russian War (1807–12). Emperor Alexander I declared war on Britain after the British attack on Denmark in September 1807. British men-of-war supported the Swedish fleet during the Finnish War and won victories over the Russians in the Gulf of Finland in July 1808 and August 1809. The success of the Russian army on land, however, forced Sweden to sign peace treaties with Russia in 1809 and with France in 1810, and to join the blockade against Britain. But Franco–Russian relations became progressively worse after 1810, and the Russian war with Britain effectively ended. In April 1812, Britain, Russia and Sweden signed secret agreements directed against Napoleon. The central issue for both Napoleon and Tsar Alexander I was control over Poland. Each wanted a semi-independent Poland he could control. As Esdaile notes, "Implicit in the idea of a Russian Poland was, of course, a war against Napoleon." Schroeder says Poland was "the root cause" of Napoleon's war with Russia but Russia's refusal to support the Continental System was also a factor. In 1812, at the height of his power, Napoleon invaded Russia with a pan-European Grande Armée, consisting of 450,000 men (200,000 Frenchmen, and many soldiers of allies