Mazepa played an important role in the Battle of Poltava (1709), where after learning that Tsar Peter I intended to relieve him as acting hetman of Zaporozhian Host and to replace him with Alexander Menshikov, he defected from his army and sided with King Charles XII of Sweden.
In 1659 Stefan Mazepa traveled to Warsaw to attend the Sejm and placed his son Ivan in service at the royal court of John II Casimir Vasa.
[9] According to late tradition, King John Casimir sent Ivan Mazepa to study "gunnery" in Deventer (Dutch Republic) in 1656–1659, during which time he traveled across Western Europe.
[10] His service at the Polish royal court earned him a reputation as an alleged catholicized "Lyakh"[11] – later the Russian Imperial government would effectively use this slur to discredit Mazepa.
[citation needed] In 1687 Ivan Mazepa accused Samoylovych of conspiring to secede from Russia, secured his ouster, and was elected the Hetman of Left-bank Ukraine in Kolomak,[17] with the support of Vasily Galitzine.
[citation needed] In 1689 Mazepa supported the deposition of Tsarevna Sophia, who had served as de-facto regent of Tsar Peter I, which helped him ingratiate himself with the monarch, who valued the wide experience and education of the much older hetman.
This success relieved both Ukraine and Muscovy from the danger of devastating enemy raids and led Peter I to award the hetman with the Order of St. Andrew, the Tsardom's highest honour.
The order, as well as the title of honourable prince of the Holy Roman Empire, awarded to the hetman by Emperor Joseph I in 1707 as recognition of his help in the fight against the Ottomans and Tatars, greatly contributed to Mazepa's status both in Ukraine and at the Moscow court.
[18] With the personal agreement of Peter I, Mazepa managed to become an undisputed ruler of the Hetmanate, concentrating most power over Ukraine, including gathering of taxes, in hands of his own administration.
In many regards Mazepa greatly contributed to the establishment of the Russian Empire by supporting the policies of Peter I and providing the monarch with people needed to bring his reformist ideas into life.
[18] Himself a highly educated person who could speak both Latin and German, Mazepa established his court in a Western manner, reflecting the influence of Baroque art and literature on Ukrainian lands during that period.
Mazepa convinced Russian Tsar Peter I to allow him to intervene, which he successfully did, taking over major portions of Right-bank Ukraine, while Poland was weakened by an invasion of Swedish king Charles XII.
In Mazepa's opinion, the strengthening of Russia's central power could put at risk the broad autonomy granted to the Cossack Hetmanate under the Treaty of Pereyaslav in 1654.
Attempts to assert control over the Zaporozhian Cossacks included demands of having them fight in any of the tsar's wars, instead of only defending their own land against regional enemies as was agreed to in previous treaties.
Ill-equipped and not properly trained to fight on par with the tactics of modern European armies, Cossacks suffered heavy losses and low morale.
[citation needed] In 1707, after vanquishing the united forces of Peter's allies - Denmark, Saxony and the Polish-Lithuanian Commonwealth, Charles XII started a campaign against Moscow.
[18] The last straw in the souring relations with Tsar Peter was his refusal to commit any significant force to defend Ukraine against the Polish King Stanisław Leszczyński, an ally of Charles XII of Sweden, who threatened to attack the Cossack Hetmanate in 1708.
Learning of Mazepa's treason, the Russian army sacked and razed the Cossack Hetmanate's capital of Baturyn, killing most of the defending garrison and many common people.
[citation needed] Surprisingly, the only significant support that he gathered came from the Zaporozhian Sich, which, though at odds with the Hetman in the past, considered him and the nobility he represented a lesser evil compared with the Tsar.
[citation needed] The Swedish and Russian armies spent the first half of 1709 maneuvering for advantage in the anticipated great battle, and trying to secure the support of the local populace.
[18] Mazepa was buried in Galați (now Romania), but his tomb was disturbed several times and eventually lost as a result of the Sfântul Gheorghe (St. George) Church demolition in 1962.
[20] As Hetman of the Zaporozhian Host, Mazepa's style was as follows: Hetman Ivan Mazepa of the Tsar's Illustrious Highness's Zaporozhian Host, Knight of the Glorious Order of the Holy Apostle Andrew (Ukrainian: Гетьман Іван Мазепа Війська Його Царської Пресвітлої Величності Запорізького, Славного Чину Святого Апостола Андрія Кавалер).
However, others argue that it was Imperial Russia who broke the treaty by not even trying to protect the Cossack homeland during busy fighting abroad while Ukrainian peasants were complaining about the conduct of local Muscovite troops.
[22][23] According to Russian historian Tatiana Tairova-Yakovlava, Mazepa had little chance of remaining in power if he hadn't risen up against Peter I, as the tsar's imperial ambitions envisioned the destruction of Ukrainian Cossack autonomy.
Until 1869, his name was even added to the list of traitors publicly cursed in Russian churches during the Feast of Orthodoxy service, along with Pugachev, Razin and False Dmitry I.
[24][25] In May 2009 the Russian foreign ministry stated in an answer to Ukraine's preparations to mark the 300th anniversary of the battle of Poltava and plans to erect a monument to Mazepa that those were attempts at an "artificial, far-fetched confrontation with Russia".