stylistic:style_transfer, information:filtering
Russian resurgence

While Charles won several decisive battles in the Commonwealth and ultimately secured the coronation of his ally Stanisław Leszczyński and the surrender of Saxony, the Russian Tsar Peter the Great embarked on a military reform plan that improved the Russian army, using the effectively organized Swedes and other European armies as role models. Russian forces managed to penetrate Ingria, where they established a new city, Saint Petersburg. Charles planned an invasion of the Russian heartland, allying himself with Ivan Mazepa, Hetman of the Ukrainian Cossacks. The size of the invading Swedish army was peeled off as Charles left Leszczyński with some 24,000 German and Polish troops, departing eastwards from Saxony in late 1707 with some 35,000 men, adding a further 12,500 under Adam Ludwig Lewenhaupt marching from Livonia. Charles left the homeland with a defense force of approximately 28,800 men, with a further 14,000 in Swedish Finland, as well as other garrisons in the Baltic and German provinces.

After securing his "favorite" victory in the Battle of Holowczyn, despite being outnumbered over three to one by the new Russian army, Charles opted to march eastwards on Moscow rather than try to seize Saint Petersburg, founded from the Swedish town of Nyenskans five years earlier. Peter the Great managed, however, to ambush Lewenhaupt's army at Lesnaya before Charles could combine his forces, thus losing valuable supplies, artillery and half of Lewenhaupt's men. Charles' Polish ally, Stanisław Leszczyński, was facing internal problems of his own. Charles expected the support of a massive Cossack rebellion led by Mazepa in Ukraine, with estimates suggesting Mazepa was able to muster about 40,000 troops. However, the Russians subjugated the rebellion and destroyed its capital, Baturin, before the arrival of the Swedish troops. The harsh climate took its toll as well, because Charles marched his troops to winter camp in Ukraine.

By the time of the decisive Battle of Poltava, in July 1709, Charles had been wounded, one-third of his infantry was dead, and his supply train had been destroyed. The king was incapacitated by a gunshot wound to the foot and was unable to lead the Swedish forces. With the numbers of Charles' army reduced to some 23,000, with many wounded or involved on the siege of Poltava, his general Carl Gustav Rehnskiöld had a clearly inferior force to face the fortified and modernized army of Tsar Peter, with some 45,000 men. The Swedish assault ended in disaster, and the king fled south to the Ottoman Empire with a small entourage, and set up camp at Bender with some 1,000 of his Caroleans ("Karoliner" in Swedish). The remainder of the army surrendered days later at Perevolochna under Lewenhaupt's command, most of them (including Lewenhaupt himself) spending the rest of their days in Russian captivity.

The Swedish defeat at Poltava marked the downfall of the Swedish Empire, as well as the founding of the Russian Empire.