In 1789 elites in the captaincy of Minas Gerais revolted, protesting the reassertion of imperial control and the imposition of new taxes. An early sign of Brazilian nationalism, the Minas Conspiracy involved prominent figures as well as military officers. The revolt failed and royal courts sentenced most of the conspirators to prison or exile. The only nonaristocratic member of the conspiracy, a military officer by the name of Joaquim Jose da Silva Xavier, became the scapegoat. Best known by his nickname, Tiradentes (Toothpuller)—one of his many professions was dentistry—he was hanged in 1793 and became a martyr for the cause of Brazilian independence.
The connection between Portugal and Brazil was severed when Napoleon I and his armies invaded Portugal and Spain in 1807 and 1808. Napoleon, who had become emperor of France following the French Revolution (1789-1799), deposed and imprisoned the Spanish king Ferdinand VII in 1808. This left the Spanish American colonies isolated from royal control and set off a chain reaction that led to a series of long and bloody wars for independence. Brazil avoided a similar fate when the monarchy fled Lisbon shortly before French troops entered the city in 1807. With the help of their British allies, who were fighting Napoleon's forces, the royal family and 10,000 Portuguese followers made an unprecedented voyage across the Atlantic to Brazil, transferring the center of the empire to Rio de Janeiro. For the first and last time in Western history, a European monarch would rule his empire from the colonies.
Portugal's prince regent, the future King John VI, arrived in Brazil in early 1808 and for the next 13 years ruled Portugal's Asian, African, and American colonies from Rio de Janeiro. In 1815 John VI elevated Brazil to the status of a kingdom, placing it on an equal footing with Portugal. The presence of the monarchy and court in Rio brought Brazilian and Portuguese elites together and paved the way for a gradual transition to independence.
By 1815 Napoleon had been defeated in Europe, opening the way for the monarchy to return to Lisbon. John VI, however, decided to remain in Brazil, but in 1820 the Portuguese army headed a revolution designed to bring about a constitutional government. The revolutionaries agreed that John VI would serve as constitutional monarch of the empire, but only on the condition that he return to Portugal. Threatened with the loss of his crown, John reluctantly left for Portugal in 1821. His 23-year-old son Pedro remained in the colony as prince regent of Brazil.
Pedro and his advisers realized that revolutions in other Latin American countries were encouraging a movement for national independence in Brazil. A new and aggressive Cortes (parliament) in Portugal contributed to the demand for independence through a series of inept actions that offended many influential Brazilians. Portuguese members of the Cortes showed open hostility toward the Brazilian representatives, whom they regarded as unsophisticated residents of a backward province. The Cortes further alienated Brazilians by attempting to restore Brazil to colonial status. Rather than trying to resist the growing momentum for independence, Pedro and his advisers decided to take control of this movement. On September 7, 1822, after receiving orders from the Portuguese Cortes curtailing his authority in Brazil, Pedro declared Brazil's independence. Thus Brazil became one of the few Latin American colonies to make a peaceful transition to independence.
Pedro became Brazil's first emperor as Pedro I. His greatest challenge was to keep this new nation of continental dimensions from fragmenting into several countries, as had happened in Spanish America. He hired Lord Thomas Cochrane, an admiral who had been thrown out of the British navy, to enforce his authority in Brazil. Cochrane defeated the small Portuguese fleet and crushed separatist revolts in the major regional centers along the coast. With a small, hired navy and very few battles, Brazil retained its unity after gaining its independence. Portugal recognized Brazil's independence in 1825.
Despite his role in leading Brazil to independence, Pedro soon lost much of his support. He had been a resident of Brazil since the age of ten, but he was still Portuguese. Although Pedro abdicated the Portuguese throne, which he inherited in 1826, many Brazilians remained suspicious of his continued involvement in the affairs of his native Portugal. Members of the Brazilian elite were dissatisfied with Pedro for a number of reasons. Many of them opposed the new constitution written under his supervision and enacted in 1824. They were also displeased when he overrode the decision of the newly created Brazilian parliament and surrounded himself with Portuguese-born cabinet ministers. In the 1820s Pedro chose to renew a longstanding struggle with Argentina over the southern border of Brazil. The struggle erupted into the Cisplatine War (1825-1828). The war was unpopular with many Brazilians, especially after Brazil suffered a major military defeat at the hands of the Argentines in 1827. Faced with widespread opposition to his rule, Pedro abdicated his Brazilian throne in 1831 and returned to Portugal.