of Colonel later that year and that of Brigade General in 1822 for leading Peruvian troops at the Battle of Pichincha (24 May 1822). He revolted against the Peruvian Congress on 26 February 1823, and forced it to elect José de la Riva Agüero as President. As commander of a Peruvian Army expedition, Santa Cruz occupied the port of Arica and defeated a royalist army at the Battle of Zepita (27 August 1823). Failing to exploit his victory, he retreated hastily. When Simón Bolívar assumed the presidency of Peru (17 February 1824), Santa Cruz joined his army and was named Chief of Staff of the Peruvian Division. In that condition, he participated of the Battle of Junín (6 August 1824). Afterwards, he was named Prefect of Ayacucho, and then Chief of Staff of the Patriot Army during the campaign for the liberation of Bolivia. As a reward for his actions, Santa Cruz received the titles of Marshal and Prefect of Chuquisaca in April 1825. Named President of the Government Council in Lima, he was in charge of the Peruvian Executive after Bolívar returned to Gran Colombia on 4 September 1826, until the collapse of the Bolivarian regime in Peru on January 27, 1827. Santa Cruz temporarily assumed the post of President until 9 June 1827, when José La Mar was elected by Congress. President of Bolivia Removed from power, Santa Cruz was named Peruvian ambassador to Chile, but he was recalled to Bolivia where he had been proclaimed as President. Sworn in on 24 May 1829, he found a country afflicted by endemic internal disorders and very near to bankruptcy. Measures undertaken to resolve these problems included purging conspirators, reforming and strengthening the Army, reforming the bureaucracy, reforming public finances, issuing new currency, issuing a new Constitution, issuing a new Civil Code based on the Napoleonic Code and establishing Cobija as a free port. The authoritarian regime imposed by Santa Cruz brought stability to Bolivia at a time when most countries in Latin America faced widespread unrest. Furthermore, it formed a solid base from which to pursue his main project, the Peru-Bolivian Confederation. Peru-Bolivian Confederation 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 Luis José de Orbegoso requested his assistance to fight the