Dom Pedro I (English: Peter I; 12 October 1798 – 24 September 1834), nicknamed "the Liberator", was the founder and first ruler of the Empire of Brazil. As King Dom Pedro IV, he reigned briefly over Portugal, where he also became known as "the Liberator" as well as "the Soldier King". Born in Lisbon, Pedro I was the fourth child of King Dom João VI of Portugal and Queen Carlota Joaquina, and thus a member of the House of Braganza. When their country was invaded by French troops in 1807, he and his family fled to Portugal's largest and wealthiest colony, Brazil.The outbreak of the Liberal Revolution of 1820 in Lisbon compelled Pedro I's father to return to Portugal in April 1821, leaving him to rule Brazil as regent. He had to deal with threats from revolutionaries and insubordination by Portuguese troops, all of which he subdued. The Portuguese government's threat to revoke the political autonomy that Brazil had enjoyed since 1808 was met with widespread discontent in Brazil. Pedro I chose the Brazilian side and declared Brazil's independence from Portugal on 7 September 1822. On 12 October, he was acclaimed Brazilian emperor and by March 1824 had defeated all armies loyal to Portugal. A few months later, Pedro I crushed the short-lived Confederation of the Equator, a failed secession attempt by provincial rebels in Brazil's northeast.A secessionist rebellion in the southern province of Cisplatina in early 1825, and the subsequent attempt by the United Provinces of the Río de la Plata to annex it, led the Empire into the Cisplatine War. In March 1826, Pedro I briefly became king of Portugal before abdicating in favor of his eldest daughter, Dona Maria II. The situation worsened in 1828 when the war in the south resulted in Brazil's loss of Cisplatina. During the same year in Lisbon, Maria II's throne was usurped by Prince Dom Miguel, Pedro I's younger brother. The Emperor's concurrent and scandalous sexual affair with a female courtier tarnished his reputation. Other difficulties arose in the Brazilian parliament, where a struggle over whether the government would be chosen by the monarch or by the legislature dominated political debates from 1826 to 1831. Unable to deal with problems in both Brazil and Portugal simultaneously, on 7 April 1831 Pedro I abdicated in favor of his son Dom Pedro II, and sailed for Europe.Pedro I invaded Portugal at the head of an army in July 1832. Faced at first with what seemed a national civil war, he soon became involved in a wider conflict that enveloped the Iberian Peninsula in a struggle between proponents of Liberalism and those seeking a return to Absolutism. Pedro I died of tuberculosis on 24 September 1834, just a few months after he and the liberals had emerged victorious. He was hailed by contemporaries and by posterity as a key figure who helped spread the liberal ideals that allowed Brazil and Portugal to move from Absolutist regimes to representative forms of government.