The peace and slow recovery of Lima was disrupted by the beginning of the "War of the Pacific" (1879 to 1883) or also known as "Saltpeter War". Originally it grew out of a dispute between Chile and Bolivia over the mineral rich territory of the Atacama dessert and Bolivia's access to the Pacific Ocean.
The Peruvian Army (without proper equipment, training and budget) was as Bolivia's ally heavily involved in the war. After having gained control of the sea, the Chilean Army started the land invasion of Peru.
By January 1881 the Chilean Army marched towards the Peruvian capital. The Peruvian army and poorly armed militias set up to defend Lima. However, Peruvian forces were defeated in the battles of San Juan and Miraflores. Lima was invaded once again, but this time by Chilean troops. The city and the upscale beach areas of Miraflores, Barranco and Chorrillos, were badly looted. Historical and cultural highly important objects were stolen.
After the plundering many buildings including the famous National Library and many churches were burnt. Civilians were forced to surrender all their valuables. Even most of Limas surrounding haciendas were plundered and then burnt down to ashes. The invasion of Lima only ended after two years in 1883, after the Peruvian government signed a treaty very favorable to Chile ending as well the "War of the Pacific".
Due to the traumatic experiences during the war Peruvians developed a cult for the heroic defenders of their nation such as Admiral Miguel Grau and Colonel Francisco Bolognesi who were killed in the war or like General Andrés Cáceres who later became a leading political figure and symbol of resistance to the occupying Chilean army. Peruvian war heroes are buried in the mausoleum called Panteón de los Próceres in the Presbitero Maestro cemetery in Lima. They also honored their heroes by naming streets, parks and plazas after them and by dedicating museums or other cultural institution to them.