The military history of Argentina spans a period of over two centuries. During the course of those years, it broke colonial ties with Spain, waged a civil war to define its organization and wars with Brazil, Paraguay, Britain and France. The military also played a role in the institutional life of the country, during a series of coups d'état that took place in the 20th century. Before independence One of the first notable military conflicts taking place in modern Argentina were the British invasions of the Río de la Plata, involving both Buenos Aires and Montevideo (currently part of Uruguay). As part of the Napoleonic Wars, a British force led by William Carr Beresford occupied Buenos Aires on June 27. The French Santiago de Liniers moved to Montevideo and led the forces that would reconquer Buenos Aires on August 12, 1806. The Viceroy Rafael de Sobremonte, who had fled from the city to Córdoba, was not allowed to return, and Liniers was trusted to organize the defense of the city against a possible British counter-attack. For this end he drafted all men capable to bear arms, regardless of their social condition (including slaves), and formed militias to defend the city. The Regiment of Patricians, composed of criollo people, was created during this time. The second invasion took place the following year. A new British army, much bigger than the first one, invaded first Montevideo and then moved to Buenos Aires, led by Lieutenant-General John Whitelocke. The British found a strong resistance and were forced to surrender, and return Montevideo to the viceroyalty. As a result of the invasions, Sobremonte was removed as viceroy, and replaced by Liniers. The Regiment of Patricians, led by Cornelio Saavedra, became a strong political force in Buenos Aires, and was instrumental to the failure of the Mutiny of Álzaga and the success of the May Revolution. 19th century War of independence The May Revolution ousted the Viceroy Baltasar Hidalgo de Cisneros and replaced him with a junta, the Primera Junta. The viceroyalty was also renamed, removing the "viceroyalty" word from it, and it nominally became the United Provinces of the Río de la Plata. However, the status of the different territories that used to belong to the viceroyalty changed many times during the development of the war, as some regions would remain loyal to the former organization, others were captured or recaptured, and later they