As President of Bolivia, Santa Cruz instigated several failed plots to achieve a political union with Peru, taking advantage of that country's chronic political unrest. His best opportunity came in 1835 when the Peruvian President General Luis José de Orbegoso requested his assistance to fight the rebel armies of Generals Agustín Gamarra and Felipe Santiago Salaverry. Santa Cruz defeated Gamarra at the Battle of Yanacocha on 13 August 1835 and Salaverry at the Battle of Socabaya on 7 February 1836.