The Empire of Brazil was a 19th-century state that broadly comprised the territories which form modern Brazil and Uruguay. Its government was a representative parliamentary constitutional monarchy under the rule of Emperors Dom Pedro I and his son Dom Pedro II. A colony of the Kingdom of Portugal, Brazil became the seat of the Portuguese colonial Empire in 1808, when the Portuguese Prince regent, later King Dom João VI, fled from Napoleon's invasion of Portugal and established himself and his government in the Brazilian city of Rio de Janeiro. João VI later returned to Portugal, leaving his eldest son and heir, Pedro, to rule the Kingdom of Brazil as regent. On 7 September 1822, Pedro declared the independence of Brazil and, after waging a successful war against his father's kingdom, was acclaimed on 12 October as Pedro I, the first Emperor of Brazil. The new country was huge but sparsely populated and ethnically diverse.
Unlike most of the neighboring Hispanic American republics, Brazil had political stability, vibrant economic growth, constitutionally guaranteed freedom of speech, and respect for civil rights of its subjects, albeit with legal restrictions on women and slaves, the latter regarded as property and not citizens. The empire's bicameral parliament was elected under comparatively democratic methods for the era, as were the provincial and local legislatures. This led to a long ideological conflict between Pedro I and a sizable parliamentary faction over the role of the monarch in the government. He faced other obstacles. The unsuccessful Cisplatine War against the neighboring United Provinces of the Río de la Plata in 1828 led to the secession of the province of Cisplatina (later to become Uruguay). In 1826, despite his role in Brazilian independence, he became the king of Portugal; he immediately abdicated the Portuguese throne in favor of his eldest daughter. Two years later, she was usurped by Pedro I's younger brother Miguel. Unable to deal with both Brazilian and Portuguese affairs, Pedro I abdicated his Brazilian throne on 7 April 1831 and immediately departed for Europe to restore his daughter to the Portuguese throne.
Pedro I's successor in Brazil was his five-year-old son, Pedro II. As the latter was still a minor, a weak regency was created. The power vacuum resulting from the absence of a ruling monarch as the ultimate arbiter in political disputes led to regional civil wars between local factions. Having inherited an empire on the verge of disintegration, Pedro II, once he was declared of age, managed to bring peace and stability to the country, which eventually became an emerging international power. Brazil was victorious in three international conflicts (the Platine War, the Uruguayan War and the Paraguayan War) under Pedro II's rule, and the Empire prevailed in several other international disputes and outbreaks of domestic strife. With prosperity and economic development came an influx of European immigration, including Protestants and Jews, although Brazil remained mostly Catholic. Slavery, which had initially been widespread, was restricted by successive legislation until its final abolition in 1888. Brazilian visual arts, literature and theater developed during this time of progress. Although heavily influenced by European styles that ranged from Neoclassicism to Romanticism, each concept was adapted to create a culture that was uniquely Brazilian.