While Peter conducted talks concerning Russia's access to the anti-Swedish coalition, he simultaneously strove to avoid her automatic entry to the war against Sweden before the conclusion of the peace with Turkey, with which Russia remained in the state of formal war since the times of the First Azov Expedition. Meanwhile the Allies were in hurry to declare the war on Sweden - in 1700 Augustus II as the king of Saxony (Poland formally was not a part to the alliance) led his army to Riga, while the Danes entered Holstein, whose ruler stood by Sweden. This was the beginning of the long
and destructive war known as the Great Northern War (1700-1721).However, the despised by everybody Charles XII proved to be an outstanding military leader. First he made short with Denmark, as he suddenly landed with his army at Copenhagen and forced the Danes to conclude the peace. At the same time in Constantinople was concluded the peace between Russia and Turkey. As soon as Peter I learned about it, he immediately went to Livonia with a 10-thousand-strong army and besieged Narva (Ivangorod). But the Swedish army surprisingly quickly came to the aid of the besieged, and in November 1700 at Narva the Russians suffered a major defeat. Interesting enough, the Swedish king and the Russian czar drew completely different conclusions. Intoxicated by an easy victory Charles, instead of pursuing the crushed Russian army as far as to Novgorod or farther, shifted military operations into Poland, chiefly to take the Polish crown from Augustus and give it to his own protégé. Therefore, for several years the war was waged chiefly on a secondary theatre in Poland, while to the main theatre, in Livonia, Charles did not attach much attention, convinced that sooner or later he will make short with Russia at will. Unlike the politically short-sighted Swedish king, the far-seeing Russian czar had learnt from the Narva lesson and, with some exaggeration, one may say that it had brought him more benefits than some victories. First of all he started formation of a new, powerful army, and paid a lot of attention to its training and armament.
The battle of Poltava passed to the History as one of the greatest Russian military victories, which became a turning point of the Great Northern War, as well as fates of Europe. For more than hundred years Swedish forces were considered invincible both on land and at sea. The 17th century indeed witnessed unseen before victories of the distant Scandinavian country, which decided about the outcome of the Thirty Years' War, and won a number of wars with Poland and Denmark, ultimately winning almost complete control over the coasts of the Baltic Sea. The Swedens introduced a lot of novelties in the art of war, the most modern ones in that epoque, and other European countries followed their example. They formed musketeer regiments after the Swedish model, they armed and trained them after the Swedish regulations, and applied Swedish tactics on the battlefields. The glory of the Swedish victories produced legends... which turned into dust on the battlefield of Poltava. The Russian victory had shaken Europe. Former allies regained their hearts - Denmark again declared war on Sweden, and Augustus II declared the peace of Altranstadt void and returned to Poland. Meanwhile Charles XII, in refuge in Turkey, undertook all the possible efforts to win Turkey over to declare war on Russia. His activities in Turkey worried Peter, who in his turn tried to convince Turkey to expel Charles out of her boundaries. Eventually, after some hesitation, Constantinople resolved to stand against Russia. In order to forestall any possible developments, Peter with his army entered Moldavia. Simultaneously he sent appeals to the Balkan Slavs to launch an uprising against the Turks. He mustered support in that matter from the Moldavian hospodar Demetrius Cantemir, who put big hopes in anti-Turkish uprising in Moldavia and Wallachia. But the uprising did not assume big scale, and the Russian army marching to the River Prut was encircled in 1711. The Turkish army outnumbered the Russians and further development of the situation could bring a disaster. The situation was saved by the peace talks, during which Russian diplomats had demonstrated far-going flexibility and generosity in bribing Turkish officials. The clauses of so-called Peace of the Prut obliged Russia to return to Turkey territories acquired on the Sea of Azov, with Azov and Taganrog, and interfere not with Polish affairs. Livonia was not mentioned in the Russo-Turkish accord, so Charles XII gained nothing from setting Turkey at odds with Russia. The Great Northern War continued, although now the strategic initiative was on the Russian side.
After Poltava the war turned into an infinite parade of Russian victories on all the fronts: the Swedens were dislodged from Livonia, Estonia, Karelia, and later also from Finland. The Russians also cleared Poland of the troops of Charles and Leszczyński, and entered Pomerania. Together with the Prussians, who on that occasion declared war on Sweden, they occupied Swedish possessions in Pomerania and Mecklenburg. In 1713 Menshikov took Stettin and handed it over to the Prussians. Also the Swedish navy suffered heavy defeats: in 1714 off the Cape Gangut (nowadays Hanko in south-west Finland), and in 1720 off the Gronhamn Island in the Aland archipelago. Peter also tried to involve France in the war along the allies and in 1717 once again he travelled with embassy to the West. The embassy did not bring any political results, but Peter did not return from the voyage empty-handed: he bought there a huge collection of anatomical preparates, as well as specimens of exotic animals, birds, reptiles and insects, and donated them all to the Academy of Sciences.In 1718 started peace talks between Sweden and Russia, broken after the sudden death of Charles XII, who at the end of the year was killed during the siége of the fortress Frederikshald in Norway. Charles' successors tried to turn the fates of the war over, but Russian landings in Sweden, and especially a large landing staged near Stockholm, forced them to resume peace talks. The peace treaty, that finished the Great Northern War, was signed in 1721 in Nystad (nowadays Uusikaupunki in south-west Finland). By the terms of the Treaty of Nystad, Russia acquired all the Karelia with Vyborg, Ingria or Ingermanland (areas along the Gulf of Finland between Karelia and Estonia), Estonia with islands of Osel (Saaremaa) and Dago (Hiiumaa), and Livonia with Riga. Sweden recovered Finland. In Livonia and Estonia Russia left intact existing rights and privileges of both provinces, in particular the freedom of the Protestant religion - it fit the interests of the local German gentry, who were the greatest landowners in Livonia and Estonia, and under the leadership of Johann Patkul supported Russia in her war with Sweden. Since then the Baltic Germans of Livonia and Estonia (and later also Courland) had been playing a particularly distinct and active role in the political life of Russia, enjoying big influence at the court in Petersburg, and occupying the highest civil and military offices.
The Treaty of Nystad became Russia's great political triumph - Russia acquired broad access to the Baltic Sea from Vyborg to Riga with big ports in Riga and Reval, and the port in Petersburg under construction since 1713. Unlimited opportunities of sea trade and contacts with Europe via the Baltic Sea had opened. Celebration of the conclusion of the peace was very solemn; on that occasion Peter I assumed the title of emperor. His new title was immediately recognized in Prussia and Holland. Sweden recognized it in 1723, and other European countries did it even later; the last one was Poland, which did recognize the imperial title until 1764.The Great Northern War filled most of Peter I's policy, but the czar did not forget about the questions of the South and the East. In 1717 he sent an expedition to the Central Asia, but it perished almost entirely, so only fragmentary information concerning its fates have reached us. A substantial although short-lived success was the war with Persia. It was provoked by the predicaments of the czar of Kartlia (eastern Georgia), Vakhtang VI, to put the end to the Persian domination and unite with Russia. During the Persian campaign, which the czar originally led in person, Russian troops took Derbent and Baku on the western, and Rasht on the southern shores of the Caspian Sea. According to the peace treaty signed in Petersburg in 1723, Russia kept occupied territories, as well as Persian provinces of Mazandaran and Astrabad. This way Russian possessions spread along a narrow strip around the Caspian Sea from the mouth of Terek in the north to the south-east. But it was impossible to hold those possessions and in 1732 Russia returned them to Persia.