quality:corruption
War of Independence

During the British invasions of the Río de la Plata, British forces attacked Buenos Aires twice. In 1806 the British successfully invaded Buenos Aires, but an army from Montevideo led by Santiago de Liniers defeated them. In the brief period of British rule, the viceroy Rafael Sobremonte managed to escape to Córdoba and designated this city as capital. Buenos Aires became the capital again after its recapture by Argentine forces, but Sobremonte could not resume his duties as viceroy. Santiago de Liniers, chosen as new viceroy, prepared the city against a possible new British attack and repelled a second invasion by Britain in 1807. The militarization generated in society changed the balance of power favorably for the criollos (in contrast to peninsulars), as well as the development of the Peninsular War in Spain.

An attempt by the peninsular merchant Martín de Álzaga to remove Liniers and replace him with a Junta was defeated by the criollo armies. However, by 1810 it would be those same armies who would support a new revolutionary attempt, successfully removing the new viceroy Baltasar Hidalgo de Cisneros. This is known as the May Revolution, which is now celebrated as a national holiday. This event started the Argentine War of Independence, and many armies left Buenos Aires to fight the diverse strongholds of royalist resistance, with varying levels of success. The government was held first by two Juntas of many members, then by two triumvirates, and finally by a unipersonal office, the Supreme Director. Formal independence from Spain was declared in 1816, at the Congress of Tucumán. Buenos Aires managed to endure the whole Spanish American wars of independence without falling again under royalist rule.

Historically, Buenos Aires has been Argentina's main venue of liberal, free-trading, and foreign ideas. In contrast, many of the provinces, especially those to the city's northwest, advocated a more nationalistic and Catholic approach to political and social issues. In fact, much of the internal tension in Argentina's history, starting with the centralist-federalist conflicts of the 19th century, can be traced back to these contrasting views. In the months immediately following said "May Revolution", Buenos Aires sent a number of military envoys to the provinces with the intention of obtaining their approval. Instead, the enterprise fueled tensions between the capital and the provinces; many of these missions ended in violent clashes.

In the 19th century the city was blockaded twice by naval forces: by the French from 1838 to 1840, and later by an Anglo-French expedition from 1845 to 1848. Both blockades failed to bring the Argentine government to the negotiating table, and the foreign powers eventually desisted from their demands.