Born in 1796 in San Luis Province, he studied in a Franciscan monastery when young, and left his studies to join the Regiment of Mounted Grenadiers being summoned by José de San Martín to fight in the War of Independence against Spanish rule. In 1815, he fought in the Battles of Chacabuco and Battle of Maipú, in Chile; and then in the campaign to liberate Peru. He was imprisoned by the Spanish during the former campaign in Chiloé Island, but managed to escape and rejoin his army.