The Captaincy General of Chile had removed their governor in 1810, and replaced him with the First Government Junta, starting a period of Chilean history known as Patria Vieja. However, they would be defeated in 1814 during the battle of Rancagua, and with the Reconquista Chile would become again a royalist stronghold. Bernardo O'Higgins and other Chilean leaders had fled to Mendoza during the new royalist government, which led to O'Higgins being part of the Army of the Andes as well as the Argentine soldiers.