Under Bolivar, he was involved in the purchase of armaments, issuing military orders, recruitment, and personnel assignments. Sucre also run a spy network against the royalists until they retreated into the highlands southwest of Lima. Sucre is particularly famous for the Battle of Pichincha in 1822, where he quashed the Spaniards and liberated Ecuador. There is also the case of the Battle of Ayacucho, where he triumphed over Royalist army despite being vastly outnumbered. His forces sustained 309 dead and 607 wounded to the Royalists' 1,400 dead and 700 wounded. His ability as a statesman was tested when he engaged in diplomatic missions, negotiating the armistice with Spain particularly in 1820.