Kingdom of Portugal
After the Portuguese Restoration War of 1640–1668, the kingdom passed to the House of Braganza and thereafter to the House of Braganza-Saxe-Coburg and Gotha. From this time, the influence of Portugal declined, but it remained a major power due to its most valuable colony, Brazil. After the independence of Brazil, Portugal sought to establish itself in Africa, but was ultimately forced to yield to the British interests, leading to the collapse of the monarchy in the 5 October 1910 revolution and the establishment of the First Portuguese Republic.
Brazil
With the end of the Peninsular War in 1814, the courts of Europe demanded that Queen Maria I and Prince Regent João return to Portugal, deeming it unfit for the head of an ancient European monarchy to reside in a colony. In 1815, to justify continuing to live in Brazil, where the royal court had thrived for the prior six years, the Crown established the United Kingdom of Portugal, Brazil, and the Algarves, thus creating a pluricontinental transatlantic monarchic state. However, such a ploy didn't last long, since the leadership in Portugal, resentful of the new status of its larger colony, continued to require the return of court to Lisbon (as postulated by the Liberal Revolution of 1820), and also groups of Brazilians, impatient for practical and real changes, still demanded independence and a republic, as demonstrated by the 1817 Pernambucan Revolt.
In 1821, as a demand of revolutionaries who had taken the city of Porto, D. João VI was unable to hold out any longer, and departed for Lisbon. There he swore an oath to the new constitution, leaving his son, Prince Pedro de Alcântara, as Regent of the Kingdom of Brazil.