He was appointed mayor of the city of La Paz in 1810. As mayor, he contributed to the construction of the public jail, founded the women's hospital at his own expense, and did the same in the city of Cochabamba before emigrating to Chile. He returned to Bolivia after the Battle of Ayacucho in 1824. He rose to the rank of colonel and was appointed Prefect of the Department of La Paz.