By 1821, the Spanish colonial empire in Latin America was falling apart because of the Napoleonic occupation of Spain and the troops of generals Bolivar and Sucre, who had already liberated Venezuela, Colombia and Ecuador, were already approaching the Upper Peru region.