However, the improvised army gathered by Liniers at Cordoba deserted him before battle, so the former Viceroy attempted to flee to the Upper Peru, expecting to join the royalist army sent from the Viceroyalty of Peru to suffocate the revolution at Buenos Aires. Colonel Francisco Ortiz de Ocampo, who led the patriot army, captured Liniers and the other leaders of the Cordoba counter-revolution on 6 August 1810, but, instead of executing them as he was instructed, he sent them back to Buenos Aires as prisoners. As a result, Ocampo was demoted and Juan José Castelli was appointed as the political head of the army. On 26 August, Castelli executed the Cordoba prisoners and led the Army of the North towards the Upper Peru.