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.