Come and ask, answer or inform.
Recognition of Brazil's independence was not obtained peacefully. Some provincial governors opposed the wishes of the supporters of D. Pedro I of Brazil, son of the King of Portugal D. João VI.
D. Pedro I of Brazil, would also become D. Pedro IV of Portugal, nicknamed "the Soldier King". He was the first Emperor of Brazil, from 1822 until his abdication in 1831, and simultaneously King of Portugal and the Algarves as Pedro IV between March and May 1826.
As Emperor of Brazil, he ordered the acquisition of ships and the hiring of military personnel in order to consolidate the territories and their political supremacy in the new country.
Among other places, there was opposition in the state of Bahia. The loyal governor of Portugal, Brigadier Inácio Madeira de Melo, maintained an armed opposition with the help of troops from Portugal. The main combat sites were located in Alagoas and Pernambuco.
The city of Salvador, loyal to Portugal was surrounded by Brazilian separatist forces, and there was a naval blockade by British ships, commanded by Lord Cochrane, who supported the separatist forces and prevented the supply of Portuguese troops by sea. Governor Madeira de Melo eventually gave in to pressure from Brazilian troops, having capitulated and returned to Portugal.
In June 1822, the military garrisons of the Cisplatina region (present-day Uruguay), led by Alvaro da Costa de Sousa Machado, declared their loyalty to the Government of Portugal. The city of Montevideo was surrounded by Brazilian independentist troops. In October 1823, ships of the Brazilian Navy interdicted the River Plate, the only maritime exit from the Cisplatina province. Without outside military support the Governor handed over the city and withdrew to Portugal.
With the removal of Governor Álvaro da Costa, the fight for independence of Brazil ended.