 Thereafter he was named captain general and intendant of Yucatán, a post that he occupied from 1800 to 1811.In August 1810 he was named viceroy of New Granada to replace Francisco Javier Venegas (who had never actually occupied the position).He stopped first in Mérida, Yucatán and Havana to gather resources for the reconquest of Cartagena, which was in rebel hands.