The Russians won decisively at the Battle of Poltava in June 1709, capturing much of the exhausted Swedish army. Charles XII and the remnants of his army were cut off from Sweden and fled south into Ottoman territory, where he remained three years. He overstayed his welcome, refusing to leave until the Ottoman Empire joined him in a new war against Tsar Peter I of Russia. He established a powerful political network in Constantinople, which included even the mother of the sultan. Charles's persistence worked, as Peter's army was checked by Ottoman troops. However, Turkish failure to pursue the victory enraged Charles and from that moment his relations with the Ottoman administration soured. During the same period, the behavior of his troops worsened and turned disastrous. Lack of discipline and contempt for the locals soon created an unbearable situation in Moldavia. The Swedish soldiers behaved badly, destroying, stealing, raping, and killing. Meanwhile, back in the north, Sweden was invaded by its enemies; Charles returned home in 1714, too late to restore his lost empire and impoverished homeland; he died in 1718. In the subsequent peace treaties, the allied powers, joined by Russia and Great Britain-Hanover, ended Sweden's reign as a great power. Russia now dominated the north. The war-weary Riksdag asserted new powers and reduced the crown to a constitutional monarchy, with power held by a civilian government controlled by the Riksdag. A new "Age of Freedom" opened, and the economy was rebuilt, supported by large exports of iron and lumber to Britain. The Riksdag developed into an active parliament. This tradition continued into the nineteenth century, laying the basis for the transition towards a modern democracy.