Ejército Trigarante
Carrera entered the military at the age of 9 as a cadet in the Expeditionary Regiment of King Ferdinand VII of Spain. By 1818, he was an instructor in New Spain. He joined the insurgent Army of the Three Guarantees after the Battle of Huerta (30 August 1821). He was with the army when it triumphally entered Mexico City on 27 September 1821.