Viceroyalty of New Granada
He fought in the Spanish War of Independence against the French, and in the Viceroyalty of New Granada against rebels supporting independence. From 1819 to 1821 he was viceroy of New Granada — the last Spanish viceroy of the colony.