The Independence of Brazil comprised a series of political and military events that occurred in 1821–1824, most of which involved disputes between Brazil and Portugal regarding the call for independence presented by the Brazilian Empire.
It is celebrated on 7 September, the anniversary of the date in 1822 that prince regent Dom Pedro declared Brazil's independence from Portugal. Formal recognition came with a treaty signed by both Brazil and Portugal in late 1825.
The land now called Brazil was claimed by Portugal in April 1500, on the arrival of the Portuguese fleet commanded by Pedro Álvares Cabral. The Portuguese encountered Indigenous nations divided into several tribes, most of whom shared the same Tupi-Guaraní language family, and shared and disputed the territory.
Though the first settlement was founded in 1532, colonization was effectively started in 1534 when King John III divided the territory into fifteen hereditary captaincies. This arrangement proved problematic, however, and in 1549 the king assigned a Governor-General to administer the entire colony. The Portuguese assimilated some of the native tribes while others slowly disappeared in long wars or by European diseases to which they had no immunity..
By the mid-16th century, sugar had become Brazil's most important export due to the increasing international demand for sugar. To profit from the situation, by 1700 over 963,000 African slaves had been brought across the Atlantic to work in Brazil. More Africans were brought to Brazil up until that date than to all the other places in the Americas combined.
Through wars against the French, the Portuguese slowly expanded their territory to the southeast, taking Rio de Janeiro in 1567, and to the northwest, taking São Luís in 1615. They sent military expeditions to the Amazon rainforest and conquered English and Dutch strongholds, founding villages and forts from 1669. In 1680 they reached the far south and founded Sacramento on the bank of the Rio de la Plata, in the Banda Oriental region (present-day Uruguay).
At the end of the 17th century, sugar exports started to decline but beginning in the 1690s, the discovery of gold by explorers in the region that would later be called Minas Gerais (General Mines) in current Mato Grosso, Goiás and the state of Minas Gerais, saved the colony from imminent collapse. From all over Brazil, as well as from Portugal, thousands of immigrants came to the mines.
The Spanish tried to prevent Portuguese expansion into the territory that belonged to them according to the 1494 Treaty of Tordesillas, and succeeded in conquering the Banda Oriental in 1777. However, this was in vain as the Treaty of San Ildefonso, signed in the same year, confirmed Portuguese sovereignty over all lands proceeding from its territorial expansion, thus creating most of the current Brazilian border.
During the invasion of Portugal (1807), the Portuguese royal family fled to Brazil, establishing Rio de Janeiro as the de facto capital of Portugal. This had the side effect of creating within Brazil many of the institutions required to exist as an independent state; most importantly, it freed Brazil to trade with other nations at will.
After Napoleon's army was finally defeated in 1815, in order to maintain the capital in Brazil and allay Brazilian fears of being returned to colonial status, King John VI of Portugal raised the de jure status of Brazil to an equal, integral part of a United Kingdom of Portugal, Brazil, and the Algarves, rather than a mere colony, a status which it enjoyed for the next seven years.
In 1820 the Constitutionalist Revolution erupted in Portugal. The movement initiated by the liberal constitutionalists resulted in the meeting of the Cortes (or Constituent Assembly), that would have to create the kingdom's first constitution. The Cortes at the same time demanded the return of King Dom John VI, who had been living in Brazil since 1808, who elevated Brazil to a kingdom as part of the United Kingdom of Portugal, Brazil and the Algarves in 1815 and who nominated his son and heir prince Dom Pedro as regent, to govern Brazil in his place on 7 March 1821. The king left for Europe on 26 April, while Dom Pedro remained in Brazil governing it with the aid of the ministers of the Kingdom (Interior) and Foreign Affairs, of War, of Navy and of Finance.
The Portuguese military officers headquartered in Brazil were completely sympathetic to the Constitutionalist movement in Portugal. The main leader of the Portuguese officers, General Jorge de Avilez Zuzarte de Sousa Tavares forced the prince to dismiss and banish from the country the ministers of Kingdom and Finance. Both were loyal allies of Pedro, who had become a pawn in the hands of the military. The humiliation suffered by the prince, who swore he would never yield to the pressure of the military again, would have a decisive influence on his abdication ten years later. Meanwhile, on 30 September 1821, the Cortes approved a decree that subordinated the governments of the Brazilian provinces directly to Portugal. Prince Pedro became for all purposes only the governor of the Rio de Janeiro Province. Other decrees that came after ordered his return to Europe and also extinguished the judicial courts created by João VI in 1808.
Dissatisfaction over the Cortes measures among most residents in Brazil (both Brazilian-born and Portuguese-born) rose to a point that it soon became publicly known. Two groups that opposed the Cortes' actions to gradually undermine the Brazilian sovereignty appeared: Liberals led by Joaquim Gonçalves Ledo (which had the support of the Freemasons) and the Bonifacians led by José Bonifácio de Andrada. Both factions had nothing in common in their goals for Brazil, with the sole exception of their desire to keep the country united with Portugal as a sovereign monarchy.
The Portuguese deputies of the Cortes showed no respect towards the prince and openly mocked him. And so the loyalty that Pedro had shown towards the Cortes gradually shifted to the Brazilian cause. His wife, princess Leopoldina of Habsburg, favoured the Brazilian side and encouraged him to remain in the country while the Liberals and Bonifacians made open representations. Pedro's reply came on 9 January 1822, who, according to newspapers, spoke: "As it is for the good of all and for the nation's general happiness, I am ready: Tell the people that I will stay".
After Pedro's decision to defy the Cortes, around 2,000 men led by Jorge Avilez rioted before concentrating on mount Castelo, which was soon surrounded by 10,000 armed Brazilians, led by the Royal Police Guard. Dom Pedro then "dismissed" the Portuguese commanding general and ordered him to remove his soldiers across the bay to Niterói, where they would await transport to Portugal.
Jose Bonifácio was nominated minister of Kingdom and Foreign Affairs on 18 January 1822. Bonifácio soon established a fatherlike relationship with Pedro, who began to consider the experienced statesman his greatest ally. Gonçalves Ledo and the liberals tried to minimize the close relationship between Bonifácio and Pedro offering to the prince the title of Perpetual Defender of Brazil. For the liberals, the meeting of a Constituent Assembly for Brazil was necessary, while the Bonifacians preferred that Pedro grant the constitution himself to avoid the possibility of similar anarchy to the one that occurred during the first years of the French Revolution.
The prince acquiesced to the liberals’ desires and signed a decree on 3 June 1822 calling for the election of the deputies that would gather in the Constituent and Legislative General Assembly in Brazil.
This section needs additional citations for verification. (June 2017) (Learn how and when to remove this template message)
Pedro departed to São Paulo Province to secure the province's loyalty to the Brazilian cause. He reached its capital on 25 August and remained there until 5 September. While on his way back to Rio de Janeiro on 7 September he received mail from José Bonifácio and his wife, Leopoldina. The letter told him that the Cortes had annulled all acts from the Bonifácio cabinet, removed Pedro's remaining powers and ordered him to return to Portugal. It was clear that independence was the only option left. Pedro turned to his companions that included his Guard of Honor and spoke: "Friends, the Portuguese Cortes want to enslave and pursue us. From today on our relations are broken. No ties can unite us anymore" and continued after he pulled out his blue-white armband that symbolized Portugal: "Armbands off, soldiers. Hail to the independence, to freedom and to the separation of Brazil from Portugal!" He unsheathed his sword affirming that "For my blood, my honor, my God, I swear to give Brazil freedom," and later cried out: "Brazilians, Independence or death!". This event is remembered as "Cry of Ipiranga".
Returning to the city of São Paulo on the night of 7 September 1822, Pedro and his companions announced the news of Brazilian independence from Portugal. The Prince was received with great popular celebration and was called not only "King of Brazil" but also "Emperor of Brazil".
Pedro returned to Rio de Janeiro on 14 September and in the following days the liberals had spread pamphlets (written by Joaquim Gonçalves Ledo) that suggested the idea that the Prince should be acclaimed Constitutional Emperor. On 17 September the President of the Municipal Chamber of Rio de Janeiro, Josė Clemente Pereira, sent to the other Chambers of the country the news that the Acclamation would occur in the anniversary of Pedro on 12 October.
The official separation would only occur on 22 September 1822 in a letter written by Pedro to João VI. In it, Pedro still calls himself Prince Regent and his father is considered the King of the independent Brazil. On 12 October 1822, in the Field of Santana (later known as Field of the Acclamation) Prince Pedro was acclaimed Dom Pedro I, Constitutional Emperor and Perpetual Defender of Brazil. It was at the same time the beginning of Pedro's reign and also of the Empire of Brazil. However, the Emperor made it clear that although he accepted the emperorship, if João VI returned to Brazil he would step down from the throne in favor of his father.
The reason for the imperial title was that the title of king would symbolically mean a continuation of the Portuguese dynastic tradition and perhaps of the feared absolutism, while the title of emperor derived from popular acclamation as in Ancient Rome or at least reigning through popular sanction as in the case of Napoleon.  On 1 December 1822, Pedro I was crowned and consecrated.
This section does not cite any sources. (June 2017) (Learn how and when to remove this template message)
But in spite of these fine words, the new flag and the Acclamation of Pedro as Constitutional Emperor, the authority of the new regime only extended to Rio de Janeiro, São Paulo and the adjacent provinces. The rest of Brazil remained firmly under the control of Portuguese juntas and garrisons. It would take a war to put the whole of Brazil under Pedro's control. The fighting began with skirmishes between rival militias in 1822 and lasted until January 1824, when the last Portuguese garrisons and naval units surrendered or left the country.
Meanwhile the Imperial government had to create a regular Army and Navy. Forced enlistment was widespread, extending to foreign immigrants, and Brazil made use of slaves in militias, as well as freeing slaves to enlist them in army and navy. The campaigns on land and sea covered the vast territories of Bahia, Montevideo and Cisplatina, Grão-Pará. Maranhão, Pernambuco, Ceará and Piauí.
By 1822, Brazilian forces were firmly in control of Rio de Janeiro and the central area of Brazil. Loyal militias began insurrections in the aforementioned territories, but strong, and regularly reinforced Portuguese garrisons in the port cities of Salvador, Montevideo, São Luís and Belém continued to dominate the adjacent areas and to pose the threat of a reconquest that the irregular Brazilian militias and guerrilla forces, which were loosely besieging them by land supported by newly created units of the Brazilian army, would be unable to prevent.
For the Brazilians, the answer to this stalemate was to seize control of the sea. Fortunately, 11 former Portuguese warships, great and small, had fallen into Brazilian hands in Rio de Janeiro and these formed the basis of a new navy. The problem was manpower. The crews of these ships were largely Portuguese who were openly mutinous, and although many Portuguese naval officers had declared allegiance to Brazil their loyalty could not be relied on. The Brazilian Government solved the problem by recruiting 50 officers and 500 seamen in secret in London and Liverpool, many of them veterans of the Napoleonic Wars, and appointed the Thomas Cochrane as commander-in-chief. On 1 April 1823, a Brazilian squadron 6 of ships sailed for Bahia. After an initial disappointing engagement with a superior Portuguese fleet, Cochrane blockaded Salvador. Deprived now of supplies and reinforcements by sea and besieged by the Brazilian army on land, on 2 July the Portuguese forces abandoned Bahia in a convoy of 90 ships. Leaving the frigate ‘Niteroi’ under Captain John Taylor to harry them to the coasts of Europe, Cochrane then sailed north to San Luis. There he tricked the Portuguese garrison into evacuating Maranhão by pretending that a huge Brazilian fleet and army were over the horizon. He then sent Captain John Pascoe Grenfell to play the same trick on the Portuguese in Belem do Para at the mouth of the Amazon.  By November 1823, the whole of the north of Brazil was under Brazilian control, and the following month, the demoralized Portuguese also evacuated Montevideo and the Cisplatine Province. By 1824, Brazil was free of all enemy troops and was ‘de facto’ independent. 
There are still today no reliable statistics related to the numbers of, for example, the total of the war casualties. However based upon historical registration and contemporary reports of some battles of this war as well as upon the admitted numbers in similar fights that happened in these times around the globe, and considering how long the Brazilian independence war lasted (22 months), estimates of all killed in action on both sides are placed from around 5,700 to 6,200.
The last Portuguese soldiers left Brazil in 1824. A peace treaty recognizing Brazil's independence was drafted in summer 1825, and signed by Brazil and Portugal that autumn.
Media related to Independence of Brazil at Wikimedia Commons