The fortress of Nyenschantz or Nienschanz, later Schlotburg, was founded by the Swedish King Charles IX in 1611, on lands that were annexed from Russia under the pretext of not fulfilling the Vyborg Treatise.
In June 1656, the Russian voivode Pyotr Ivanovich Potemkin with a detachment of 1,000 people took Nyenschantz by storm, but after the war, both the fortress and the surrounding territories remained in Sweden.
The fortress was taken by the Russians under Peter the Great, after a week of siege on May 12, 1703 (during the Great Northern War). The city was renamed Schlotburg ("castle-town").