 The following March 21 he was sworn in as viceroy.He tried to aid the royalists of Santa Marta.Pérez resigned the viceroyalty in November 1812 under pressure from the Spanish government in Cádiz, which required him to resign nearer to Bogotá.