Peru Antonio José de Sucre they defeated the larger Spanish army in the Battle of Junín on 6 August 1824 and the decisive Battle of Ayacucho on 9 December of the same year, consolidating the independence of Peru and Alto Peru. Alto Peru was later established as Bolivia. During the early years of the Republic, endemic struggles for power between military leaders caused political instability. From the 1840s to the 1860s, Peru enjoyed a period of stability under the presidency of Ramón Castilla, through increased state revenues from guano exports. However, by the 1870s, these resources had been depleted, the country
Trujillo, Peru only stable and productive area that could organize and lead the nascent republic. The department encompassed nearly half the country. For the efforts of its people in the war of emancipation, San Martín gave it the title of "Meritorious City Loyal to the Homeland". The municipality of the city, then called a "cabildo", was given the rank of "honorable". In 1823, after the creation of the Republic of Peru, the protectorate of José de San Martín was developed. Before royal troops took the city of Lima, the first President of Peru, Don José de la Riva Agüero, together with Sánchez