Anticipating the invasion of Napoleon's army, Prince João ordered the transfer of the Portuguese royal court to Brazil before he could be deposed.
In 1820, a political revolution broke out in Portugal, the now King João VI left Brazil and returned to the metropolis, arriving in Lisbon on 4 July 1821.
[5] The clashes between the mutineers and loyal troops to Pedro continued until February 10, when the prince ordered the expulsion of the Auxiliary Division from the kingdom.
However, Brazilian forces had established a naval blockade and occupied the Barretos field, while the fortress repelled the attack, surrounding the Portuguese troops who surrendered.
Prince Pedro then "dismissed" the Portuguese commanding general and ordered him to remove his soldiers across the bay to Vila Real da Praia Grande, where they would await transport to Portugal.