History of Portugal (1777–1834)
The history of the Kingdom of Portugal and the Algarves, from the First Treaty of San Ildefonso and the beginning of the reign of Queen Maria I in 1777, to the end of the Liberal Wars in 1834, spans a complex historical period in which several important political and military events led to the end of the absolutist regime and to the installation of a constitutional monarchy in the country. In 1807, Napoleon ordered the invasion of Portugal and subsequently the royal family and its entire court migrated to Brazil, Maria I declaring the United Kingdom of Portugal, Brazil and the Algarves in 1815.
Source: Wikipedia — History of Portugal (1777–1834) (CC BY-SA 4.0)