The Portuguese assimilated some of the native tribes while others slowly disappeared in long wars or by European diseases to which they had no immunity.
After Napoleon's army was finally defeated in 1815, in order to maintain the capital in Brazil and allay Brazilian fears of being returned to colonial status, King John VI of Portugal raised the de jure status of Brazil to an equal, integral part of a United Kingdom of Portugal, Brazil, and the Algarves, rather than a mere colony, a status which it enjoyed for the next seven years.
In 1820 the Constitutionalist Revolution erupted in Portugal.
The movement initiated by the liberal constitutionalists resulted in the meeting of the Cortes (or Constituent Assembly), that would have to create the kingdom's first constitution.
The Cortes at the same time demanded the return of King Dom John VI, who had been living in Brazil since 1808, who elevated Brazil to a kingdom as part of the United Kingdom of Portugal, Brazil and the Algarves in 1815 and who nominated his son and heir prince Dom Pedro as regent, to govern Brazil in his place on 7 March 1821.
He reached its capital on 25 August and remained there until 5 September.