José Bernardo de Tagle y Portocarrero, Marquis of Torre Tagle resided in Spain between 1813 and 1817. On his return to Peru, now being a brigadier, he was appointed inspector of the army, and also named Governor of Trujillo. On the arrival of José de San Martín in Peru, he was the first Peruvian officer to hoist the national flag in the north of Peru, and on 24 December 1820 proclaimed Trujillo independent. On 26 July 1822, he was appointed provisional president by San Martin when the latter went to meet Simón Bolivar in Guayaquil. After the departure of San Martin for Chile, on 20 September, Torre Tagle was elected
Army of the North of the Royalist forces in Upper Peru. On 12 May Orozco commanding a force of 4,000 men advanced to Jujuy, and on 28 May occupied the city, then on 31 May occupied Salta. On 2 June the royalist forces defeated the patriots at Chamical (southwest of the city of Salta). At the battle of Las Cañas lieutenant colonel Rojas was killed but the force of 400 royalists was defeated. On 8 June there was a new independentist victory at Cuesta de la Pedrera (southeast of Salta), dispersing 2,000 royalists who retreated to Jujuy. At the battle of Yala another royalist