The Peruvian congress named him dictator of Peru
Thereafter, Bolívar took over the task of fully liberating Peru. The Peruvian congress named him dictator of Peru on 10 February 1824, which allowed Bolívar to reorganize completely the political and military administration. Assisted by Antonio José de Sucre, Bolívar decisively defeated the Spanish cavalry at the Battle of Junín on 6 August 1824. Sucre destroyed the still numerically superior remnants of the Spanish forces at Ayacucho on 9 December 1824.