The Warsaw Confederation was a confederation against King of Poland August II the Strong. It was formed on February 16, 1704 in Warsaw. It dethroned August II and declared Stanisław Leszczyński king. In response, the supporters of August II formed the Sandomierz Confederation on May 20. The Warsaw Confederation was eventually victorious in the civil war in Poland (1704-1706), which ended with the Treaty of Altranstädt (1706). Soon, however, after Swedish defeat in the Great Northern War, the Russians prevailed and August II resumed the Polish throne in 1709.