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.