In accordance with the 1851 treaties, Brazil intervened militarily in Uruguay as often as it deemed necessary. In 1865, the Triple Alliance was formed by the emperor of Brazil, the president of Argentina, and the Colorado general Venancio Flores, the Uruguayan head of government whom they both had helped to gain power. The Triple Alliance declared war on the Paraguayan leader Francisco Solano López and the resulting Paraguayan War ended with the invasion of Paraguay and its defeat by the armies of the three countries. Montevideo, which was used as a supply station by the Brazilian navy, experienced a period of prosperity and relative calm during the war.