Between 1822 and 1825, Brazil fought its war of independance angainst the Portuguese Empire. IOTL, it ended with total victory for the independentists. However, for the purposes of alternate history, this outcome is very far from being set in stone.
In fact, most of what I've read about this war seems to point out that the Portuguese forces were far better trained and equipped than the Brazillian ones, and as such were far more likely to win the war, which didn't happen solely because of grave tactical mistakes commited by the Portuguese leadership. There are even people who go as far as saying that prince Pedro's rebellion had been mandated by king John VI of Portugal himself, and that the Portuguese forces weren't truly fighting for victory in the war, and were merely putting on a show to appease the continental bourgeoisie (and I wouldn't even call this a fringe view, it's pretty much mainstream by now).
So, in short, any outcome in the war is possible, including a full Portuguese victory. However, I once asked in this forum what would happen in that case, and the consensus was that winning the war would actually leave the Portuguese in a very precarious position. While a militairy victory over the rebels might ensure Portuguese dominance over Brazil for a few more years, it wouldn't make the social unrest that caused the war in the first disappear. The Portuguese and Brazillian ruling classes would still have clashing interests, and that means there would be more rebellions in the future, and would only stop once one of them succeeded. 1822 was likely too late to save the United Kingdom of Portugal, Brazil and the Algalves.
However, even by the time the war errupted, not all of Brazil was in favour of indenpendance. In the northern states of Maranhão and Grão-Pará, both of them remote, sparsely populated, largely pastoral and much more socially and economically integrated with the metropole than the rest of Brazil, the majority of the population seemed to be sympathetic towards the loyalist cause. So, while Portugal, even with a total victory in the Brazillian War of Independance, would probably not the capable of holding the whole of Brazil in the long run, holding the north of the country as well as some portions of the northeast seems to be a lot more feasible.
So, my question for the forum today is, how much of Brazil can Portugal hold in the long run. Surely Maranhão and Grão-Pará, but what about other parts of the northeast. Pernambuco seemed to be overwhelmingly pro-independance in Brazil, but I belive that the population in other states, like Bahia, was about evenly divided (it's probably impossible to hold Bahia without having Pernambuco, though), and I don't know how other states, like Piauí and Ceará stood on the matter.
Anyway, what would be the consequences of Portugal continuing to hold a portion of Brazil after 1825?