In November 1807, the troops of Napoleon Bonaparte forced the Portuguese crown to seek shelter in Brazil. John VI of Portugal came to Rio de Janeiro in 1808, after abandoning Portugal made a defensive alliance with England, which escorted the Portuguese ships on the way.
In the year 1815, Brazil assumed the official name of the United Kingdom of Portugal, Brazil and Algarves, and Rio de Janeiro, therefore, rose to the rank of Court and capital. In 1820 the revolution rushes in Porto and John VI of Portugal returned to Portugal in 1821, leaving his eldest son Prince Pedro de Alcântara as Regent of Brazil.
The separation between Brazil and Portugal was held informally in January 1822, when Dom Pedro declared that he would stay in Brazil, "Fico Day" with the following words: How is it for the good of all and the general happiness of the nation, I am ready: tell the people that I will stay here. Now I just have to recommend you tranquility and union. However, the separation of Brazil is given on September 7, 1822, with the "cry of Ipiranga" which was romanticized, despite the separation previously.
After the declaration of independence, Brazil was ruled by Dom Pedro I by the year 1831, a period called the First Empire, when he abdicated in favor of his son, Dom Pedro II, then five years old.
During the period from 1831 to 1840, Brazil was ruled by various rulers in charge of running the country while the heir to the throne, Dom Pedro II, was even lower, until the coup of Age in 1840, which raised Dom Pedro II to the throne 15 years beginning the Second Empire.
From 1870 onwards, saw the growth of republican movements in Brazil, mainly after May 13, 1888, when Princess Isabel signed the Auria Law, which had already been approved by Parliament, abolishing all forms of slavery in Brazil. But the economy, which had as its main agriculture base, becoming the main coffee export product of Brazil during the reign of Peter II, replacing cane sugar. The lack of skilled labor as a result of the abolition of slavery was resolved with attracting hundreds of thousands of immigrants, mostly Italian, Portuguese and German.
In 1889, a military coup took over as Prime Minister of the Viscount of Ouro Preto, and by encouraging Republicans, Marshal Deodoro da Fonseca proclaimed the Republic and sent into exile the Imperial Family.
There was no popular participation in the proclamation of the Republic of Brazil. What happened, was technically a military coup. The Brazilian people supported the Emperor and save conflicts, there was no violence and the Imperial Family could go into exile in Europe safely. It was the end of the monarchy in Brazil and the beginning of the Republic that starts in 1889 and remains so today.