During his reign, the Great Northern War broke out between Russia and Sweden. Mazepa's alliance with Peter I caused heavy losses of cossacks and Russian interference in the Hetmanate's internal affairs. When the tsar refused to defend Ukraine against the Polish King Stanislaus Leszczynski, an ally of Charles XII of Sweden, Mazepa and some Zaporozhian Cossacks allied themselves with the Swedes on October 28, 1708. The decisive battle of Poltava (in 1709) was won by Russia, putting an end to Mazepa's goal of independence, promised in an earlier treaty with Sweden independence.