The Spanish Empire conquered the region in the 16th century and established a Viceroyalty that encompassed most of its South American colonies, with its capital in Lima. Peru formally proclaimed independence in 1821, and following the military campaigns of José de San Martín and Simón Bolívar, and the decisive battle of Ayacucho, Peru secured independence in 1824. In the ensuing years, the country enjoyed relative economic and political stability, which ended shortly before the War of the Pacific with Chile. | The Spanish Empire conquered the region in the 16th century and established a Viceroyalty that encompassed most of its South American colonies, with its capital in Lima. Peru formally proclaimed independence in 1821, and following the military campaigns of José de San Martín and Simón Bolívar, and the decisive battle of Ayacucho, Peru secured independence in 1824. In the ensuing years, the country enjoyed relative economic and political stability, which ended shortly before the War of the Pacific with Chile. |