A combined expedition of Argentine and Chilean independentistas led by Argentine General José de San Martín landed south of Lima in 1820, but did not attack the city. Faced with a naval blockade and guerrilla action on the mainland, Viceroy José de la Serna was forced to evacuate the city in July 1821 to save the royalist army. Fearing a popular uprising and lacking the means to impose order, the City Council invited San Martín to enter Lima, signing a Declaration of Independence at his request. However, the war was not over and in the next two years the city changed hands many times, suffering abuse from both sides.
Proclaimed the independence of Peru in 1821 by General Don José de San Martín, Lima became the capital of the brand new Republic of Peru. Thus, Lima was the seat of the liberator’s government and also the seat of the first constituent Congress that Peru had.
According to Philosophynearby, the first years of Peruvian republican history were characterized by the constant confrontation between military leaders, whose objective was to govern the country and for which they tried to take the seat of government. Thus, Lima suffered several sieges and armed confrontations in its streets.
From an urban point of view, the constant growth that the city experienced gave rise to a phenomenon of modernization. In 1862 the process of change in the urban nomenclature of the city began and in 1868, by order of President José Balta, the demolition of the surrounding walls was ordered, giving way to the first great avenues. This modernization was stopped with the beginning of the War of the Pacific and the subsequent Chilean occupation.
After the withdrawal of the invading army, Lima began a reconstruction process, which was limited due to the confrontations between Andrés Avelino Cáceres and Nicolás de Piérola. In the last years of the 19th century, with Piérola assuming power and the beginning of what was called the Aristocratic Republic, Lima began its true and intense reconstruction that lasted until the remodeling that Augusto B. Leguía carried out in preparation for the centenary of the independence in 1921.
At the beginning of the 20th century, the construction of avenues began to serve as a matrix for the development of the city. The avenues Paseo de la República, Avenida Leguía (today called Arequipa), Avenida Brasil and the scenic Avenida Salaverry were built, which went to the south and the avenues Venezuela and Colonial to the west, joining the port of Callao.
In the 1930s, the great constructions began with the remodeling of the Government Palace and the Municipal House. These constructions had their peak in the 1950s, during the government of Manuel A. Odría when the large buildings of the Ministry of Economy and the Ministry of Education were built (Alzamora Valdez Building, current headquarters of the Superior Court of Justice of Lima), the Ministry of Health, Ministry of Labor and Hospitals for Workers’ and Employee Insurance as well as the National Stadium and several large housing units.
Also in those years, a phenomenon that changed the configuration of the city began, which was the massive immigration of residents from the interior of the country, producing the exponential growth of the capital’s population and the consequent urban expansion. The new populations were settling on land near the center which was used as an agricultural area. The current districts of Lince, La Victoria towards the south were populated ; Breña and Pueblo Libre to the west; El Agustino, Ate and San Juan de Lurigancho to the east and San Martín de Porres y Comas to the north. As an emblematic point of this expansion, in 1976 the self-managed community of Villa el Salvador (current District of Villa El Salvador) was created, located 30 km south of the city center and currently integrated into the metropolitan area.
In the 1980s, terrorist violence added to the disorderly growth of the city the increase of settlers arriving as internally displaced persons. The historic center of the city suffered increasing deterioration and many areas of the city constantly lacked basic services.
At the beginning of the 21st century, the metropolitan area is home to 8,447,260 residents and is conurbation with Callao. There are efforts for the total recovery of the historic center of the city, which in 1991 was classified by UNESCO as a World Heritage Site, and for the construction of important road improvements that allow solving the transportation problem.