
Lima is the capital and largest city of Peru, located in the Chillón, Rímac and Lurín river valleys along the Pacific coast. Known to the Inca by Itchyma and later Limaq, Lima was founded by the Spanish in 1535 under the name Ciudad de los Reyes in honor of the feast of the Epiphany. However, the city soon became widely known as Lima, and it survived Manco Capac II's siege in 1536 and became the capital of the Viceroyalty of Peru and the seat of an Audiencia. However, violent earthquakes destroyed a large part of Lima from 1586 to 1687, leading to the city's once-booming mercantile trade being surpassed by Buenos Aires. A combined Argentine-Chilean army led by Jose de San Martin liberated Lima in July 1821 after Viceroy Jose de la Serna evacuated the city, and Peru signed a declaration of independence on 28 July 1821. Lima became the capital of the newly-established Republic of Peru, but the city went on to change hands several times during the Peruvian War of Independence, and it was considerably impoverished by the time of the 1824 Battle of Ayacucho. It was not until the 1850s that a rise in guano exports resulted in Lima's recovery from the ravages of war, and a railroad line to Callao was completed in 1850, while the city walls were demolished in 1872 to enable the city's growth. During the War of the Pacific, the Chilean army occupied Lima and looted museums, public libraries, and educational institutions while plundering wealthy citizens and the Asian colony in the city. The city once again recovered and went through a major growth phase from the 1930s to the 1950s, with inhabitants of Peru's interior moving into the capital as it expanded. Lima came to be the world's third-largest desert city after Karachi, Pakistan and Cairo, Egypt, and the arrival of impoverished migrants resulted in the development of large-scale slums on the city's outskirts. In 2023, Lima had a population of 9,751,717 people, with the majority being mestizos, followed by Europeans of mostly Spanish, Italian, and German descent, Aimara and Quechua Indians, Afro-Peruvians, and an Asian community composed primarily of Chinese and Japanese descendants. In 2007, 82.83% of Lima residents were Catholic, while 10.9% were evangelical, 3.15% other, and 3.13% unaffiliated.