In 1813, general Pío de Tristán, under orders from Goyeneche, chased the Army of the River Plate South to Argentine territory. Tristán attacked the Belgrano's Army of the North and was defeated at the Battle of Tucumán. A few months later, Tristán was defeated again at the Battle of Salta, falling prisoner along with his whole army. Goyeneche's armies were left unprotected in their southern flank, which forced him to retreat towards Oruro. Goyeneche resigned as commander in chief and was substituted by Joaquín de la Pezuela, returning to Spain shortly afterwards.