Spanish hopes of the border settlement helping economic growth were hampered by the 1779-1783 war with Britain that restricted trade with mainland Spain and led to high tariffs and taxes to pay for it. Portugal regained the Misiones Orientales in the Treaty of Badajoz (1801) while in the Napoleonic Wars the loss of much of the Spanish navy at the Battle of Trafalgar in 1805 severed links between the central government and their overseas possessions, the Spanish criollos were still able to successfully defend the Rio de la Plata from British invasion in both 1806 and 1807 British invasions of the River Plate. Between 1809 and 1829, the Spanish American wars resulted in the independence of Spanish colonies in the Americas, the Viceroyalty of Río de la Plata being dissolved during the 1810-1818 Argentine War of Independence.