In 1765 at the age of 45, Gálvez arrived in New Spain, which included all of Spanish North America. As "visitador del virreinato de Nueva España" (inspector general for the viceroyalty of New Spain) he exercised sweeping powers; the most in Spanish North America. The "visitador" served as the king's special deputy, with special powers overlapping and sometimes exceeding those of the viceroy. Gálvez was given the task of reforming the finances of New Spain to increase its revenues for the crown — part of the energetic attempts to reorganize king Carlos III's government after the costly Seven Years' War, which had in 1762 seen the British capture both Havana, Spain's main Caribbean port, and Manila, Spain's governmental and commercial center in the Philippines and also resulted in Spain ceding Florida to Britain.