In the course of the Great Northern War, Sheremetev clashed with the Swedish general Lewenhaupt, who beat him at Gemäuerthof in July 1705, and Charles XII, who defeated him at Holowczyn (July 1708). Sheremetev's revenge came at the Battle of Poltava in 1709, where he functioned as the senior Russian commander of the forces which soundly defeated the Swedish army. Armies under his command conquered Riga in 1710. Sheremetev then led the main forces of the army against the Ottomans in the Prut campaign of 1710-1711. Fighting against Turkey in 1711, he suffered encirclement at the Battle of Stănileşti on the Prut (July 1711). In 1715–17 Sheremetev commanded armies in Pomerania and in Mecklenburg.