Brazil, uniquely among South American countries, achieved a peaceful transition to independence. The odds seemed against it at one point. Brazilian resentment at their exclusion from government, and at the Portuguese monopoly of foreign trade, grew steadily during the eighteenth century. It culminated, in 1789, in the
Inconfidência Mineira , a plot hatched by twelve prominent citizens of Ouro Preto to proclaim Brazilian independence. The rebels, however, were betrayed almost before they started - their leader,
Tiradentes , was executed and the rest exiled. Then, just as the tension seemed to be becoming dangerous, events in Europe once again took a hand in shaping Brazil's future.
In 1807, Napoleon invaded Portugal. With the French army poised to take Lisbon, the British navy hurriedly evacuated King João VI to Rio, which was declared the temporary capital of the Portuguese Empire and seat of the government-in-exile. While Wellington set about driving the French from Portugal, the British were able to force the opening-up of Brazil's ports to non-Portuguese shipping, and the economic growth that followed reinforced Brazil's increasing self-confidence. João was entranced by his tropical kingdom, unable to pull himself away even after Napoleon's defeat. Finally, in 1821, he was faced with a liberal revolt in Portugal that threatened to topple the monarchy, and he was unable to delay his return any longer. In April 1822 he appointed his son, Dom Pedro , as prince regent and governor of Brazil; when he sailed home, his last words to his son were "Get your hands on this kingdom, before some adventurer does."
Pedro, young and arrogant, grew increasingly irritated by the strident demands of the Côrtes, the Portuguese assembly, that he return home to his father and allow Brazil to be ruled from Portugal once again. On September 7, 1822, Pedro was out riding on the plain of Ypiranga, near São Paulo. Buttoning himself up after an attack of diarrhoea, he was surprised by a messenger with a bundle of letters from Lisbon. Reading the usual demands for him to return, his patience snapped, and he declared Brazil independent with the cry "Independence or death!" With overwhelming popular support for the idea, he had himself crowned Dom Pedro I , Emperor of Brazil, on December 1, 1822. The Portuguese, preoccupied by political crises at home and demoralized by Pedro's defection, put up little resistance. Apart from an ugly massacre of Brazilian patriots in Fortaleza, and some fighting in Bahia, the Portuguese withdrawal was peaceful and by the end of 1823 no Portuguese forces remained.