By 1821, the Spanish colonial empire in Latin America was falling apart because of the Napoleonic occupation of Spain, and the troops of generals Bolívar and Sucre, who had already liberated Venezuela, Colombia and Ecuador, were already approaching the Upper Peru region.
Thus, the order given by the Emperor was to call back the troops (leaving the way clear for the libertarians to occupy these territories) claiming that "Brazil does not interfere in foreign affairs."
This episode is poorly documented, the curious thing is that the Generals Antonio Jose de Sucre and Simón Bolívar, knowing what was happening, managed to send diplomats in record time to Rio de Janeiro and these diplomats arrived even faster than the letter from the governor of Mato Grosso, so the result was that when he got the letter, the Emperor was already "head made" and the evacuation order was already given.
The occupation occurred in the region Upper Peru (now Bolivia) between July and December 1822, which mobilized the Portuguese royal troops stationed in the Captaincy of Mato Grosso and occupied three of the Peru departments: La Paz, Santa Cruz de la Sierra and the so-called Department Maritmo (Atacama) [citation needed].
Between 1823 and 1828 Colombian troops occupied Upper Peru with the leadership of Marshal Antonio José de Sucre, born in Cumaná, as the continuation of the Campaigns of the South.