 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.