on the chaotic Polish–Lithuanian Commonwealth. He was, however, soon distracted from his internal reform projects by the possibility of external conquest. He formed an alliance with Denmark's Frederick IV and Russia's Peter I to strip Sweden's young King Charles XII (Augustus' cousin) of his possessions. Poland's reward for participation in the Great Northern War was to have been the Swedish territory of Livonia. Charles proved an able military commander, however, quickly forcing the Danes out of the war and then driving back the Russians at Narva in 1700, thereby allowing him to focus on the struggle with Augustus. However, this war ultimately proved as disastrous for Sweden as for Poland. Charles defeated Augustus' army at Riga in July 1701, forcing the Polish-Saxon army to withdraw from Livonia, and followed this up with an invasion of Poland. He captured Warsaw on 14 May 1702, defeated the Polish-Saxon army again at the Battle of Kliszów (July 1702), and took Kraków. He defeated another of Augustus' armies under the command of Generalfeldmarschall Adam Heinrich von Steinau at the Battle of Pułtusk in spring 1703, and besieged and captured Toruń. By this time, Augustus was certainly ready for peace, but Charles felt that he would be more secure if he could establish someone with whom he had more influence on the Polish throne. In 1704 the Swedes installed Stanisław Leszczyński and tied the commonwealth to Sweden, which compelled Augustus to initiate military operations in Poland alongside Russia (an alliance was concluded in Narva in summer 1704). The resulting civil war in Poland (1704-1706) and the Grodno campaign (1705-1706) did not go well for Augustus. Following the Battle of Fraustadt, on 1 September 1706, Charles invaded Saxony, forcing Augustus to yield the Polish throne to Leszczyński by the Treaty of Altranstädt (October 1706). Meanwhile, Russia's Tsar Peter had reformed his army, and he dealt a crippling defeat to the Swedes at the Battle of Poltava (1709). This spelled the end of the Swedish Empire and the rise of the Russian Empire. King of Poland for the second time The weakened Polish–Lithuanian Commonwealth soon came to be regarded as almost a protectorate of Russia. In 1709 Augustus II returned to the Polish throne under Russian auspices. Once again he attempted to establish an absolute monarchy in the Polish–Lithuanian Commonwealth, but was faced with opposition from the nobility (szlachta, see Tarnogród Confederation). He was handicapped by the