Charles attacked Russia again in 1707 with the Ukrainian leader, hetman Mazeppa. After more than a 1000 km walk in 1709, the Swedish king suffered a defeat from the Tsar. Charles had to flee to Turkey. He could only return to Sweden in 1714. He tried to compensate for the lost territories by a war against Norway. During the battle he was shot in the head and died in 1718. The wars of Charles XII made Sweden weaker.