 From December 13, 1824 to November 1, 1826 he was head of state of El Salvador, while it was a state of the Central American Federation.Villacorta was a member of the assembly that met in San Salvador in 1821.He was among the signers of the declaration of independence of Central America and a member of the constituent congress of the United Provinces of Central America in 1823.