Bernardo O'Higgins accepted the position instead, and became the leader of an independent Chile. He was granted dictatorial powers as Supreme Director on 16 February 1817. On 12 February 1818, Chile proclaimed itself an independent republic. Throughout the war with the royalists, O'Higgins had engaged in an ongoing feud with José Miguel Carrera. After their retreat in 1814, O'Higgins had fared much better than Carrera, who found little support forthcoming from San Martín, O'Higgins' political ally. Carrera was imprisoned to prevent his involvement in Chilean affairs; after his escape, he ended up taking the winning side in the Argentine Federalist war, helping
Army of the North a victory at Utarango but was later defeated on 12 February by the San Juan river. Rondeau received an order to retreat to Tucumán. The army, almost beaten, marched for nine months going through Potosí and Humahuaca until reaching Tucumán. On 7 August 1816 at Trancas, Rondeau was replaced again by Manuel Belgrano. Martín Miguel de Güemes was named commander of the northern border. Belgrano moved the army to the citadel built by San Martín in the city of Tucumán. There he attempted to rebuild the morale, and materials, in search for a new action in Upper Peru, combining with