Much of his second reign involved the conflicts between Peter the Great and
Charles XII of Sweden. During the
Great Northern War Ivan Mazepa revolted against Russia and Charles moved east to join him. Both were defeated at the
Battle of Poltava in July 1709, about six months after Devlet came to the throne. Some of Mazepa's Cossacks were settled in Crimean territory at
Oleshky. Charles fled to Ottoman territory and tried to stir up a Swedish-Turkish-Crimean war against Russia. When the Turks failed to expel Charles, Peter invaded Moldavia (
Pruth River Campaign of 1710). A Turkish army went north, 40,000 Tatars under Devlet's son went northwest and Peter was surrounded. He was allowed to withdraw by signing
a treaty in which he gave up
Azov and smaller forts near the
Sea of Azov (1711). Devlet continued to press for Turkish action against the growing power of Russia. In 1713 the Sultan ordered Devlet and Ismail Pasha to escort Charles to Poland (it is not clear to which faction). Charles refused and was captured (
Skirmish at Bender). There was a shift in Turkish policy and Devlet was deposed (December 1713), partly because of his mistreatment of Charles at Bender. One source() says that in early 1711 Devlet's son Mekhmed,
Mazepa's successor and some Swedes, Poles and Turkish soldiers raided around
Bratslav, fought a number of battles and retreated to Bender at the approach of a Russian army. The same spring Devlet himself moved on
Kharkov, was defeated, and returned to Crimea. == Second dethronement and death ==