During the Siege of Cádiz, he was a second lieutenant in the artillery battalion (26 September 1809), promoted to lieutenant in 1821 and to captain on 23 December 1829.