Independence, which most of Latin America had secured by the early 1820s, came at the end of a long period of economic turmoil and political upheaval during which, it can safely be assumed, living standards fell sharply. From the outbreak of hostilities between Great Britain and Spain during the Napoleonic wars, Latin America's external trade – imports and exports – was severely disrupted. The invasion of the Iberian Peninsula by Napoleon in 1808 and the imposition of his brother Joseph as king of Spain drove the Portuguese royal family to Brazil and created a temporary alliance between Great Britain and anti-Napoleonic forces in Spain. Exports from Latin America were adversely affected and domestic trade was undermined by the flood of imports into Latin America as British merchants searched for an alternative to the blocked continental market.
Napoleon's successful invasion of Spain undermined Spanish authority in Latin America and provided the independence movement – until then weak and inchoate – with the impetus it desperately needed. By the time Napoleon had been finally defeated in 1815, the movement had acquired a dynamic of its own, and the reassertion of Spanish and Portuguese authority over the Iberian Peninsula could not be extended to Latin America. Brazil, a separate kingdom since 1815, refused to recognize the demands of João VI in Lisbon and crowned his son, Dom Pedro, as emperor in 1822.