With the decisive Swedish defeat in the Battle of Poltava, Russian tsar Peter the Great had gained the upper hand in the Great Northern War. With the main Swedish army destroyed and Swedish king Charles XII exiled to the Ottoman Empire, Augustus the Strong, whom Charles XII had dethroned as Polish king in the Treaty of Altranstädt (1706), was able to march into the Polish–Lithuanian Commonwealth and re-claim the Polish crown from the Swedish ally Stanisław Leszczyński. The territory re-conquered by Augustus in 1709 included the Polish city of Thorn (Toruń), where he met with Peter the Great to hash out the terms for a common policy regarding northeastern Europe.