What year was the end of XXX?
United Kingdom of Portugal, Brazil and the Algarves
The United Kingdom of Portugal, Brazil and the Algarves was formed in 1815, following the transfer of the Portuguese Court to Brazil during the Napoleonic invasions of Portugal, and it continued to exist for about one year after the return of the Court to Europe, being de facto dissolved in 1822, when Brazil proclaimed its independence.
1822