The Peruvian congress named Bolívar dictator of Peru on 10 February 1824, which allowed him 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.