Army of the Three Guarantees
He entered the Spanish colonial army as an infantry cadet on 6 January 1812. He participated in 22 actions in the Mexican War of Independence on the Spanish side. He was arrested for criticizing King Ferdinand VII and sentenced to exile to Spain. However, he escaped imprisonment and remained in Mexico. He joined the Army of the Three Guarantees, led by Agustín de Iturbide, where he participated in another 11 military actions. In June 1821, under the First Mexican Empire, he was made a lieutenant colonel.