fortress. The oldest mention of Saint Nicolai church dates to 1276. Modern Słupsk possibly received its city rights in 1265. Historians argue that city rights were granted for the first time in a document dated 9 September 1310 when Brandenburgian margraves Waldemar and Johann V granted those privileges under Lübeck law, which was confirmed and extended in a second document, dated 2 February 1313. The margraves had acquired the area in 1307. Mestwin II accepted them as his superiors in 1269, confirmed in 1273, but later on, in 1282, Mestwin II and Polish Duke Przemysł II signed the Treaty of Kępno, which transferred the suzerainty over Gdańsk Pomerania including Słupsk to Przemysł II. After Mestwin II's death the city was reintegrated with Poland and remained Polish until 1307, when the Margraviate of Brandenburg took over, while leaving local rule in the hands of the Swenzones dynasty, whose members were castellans in Słupsk. In 1337, the governors of Słupsk (Stolp) had purchased the village of Stolpmünde (modern Ustka) and then constructed a port there, enabling a maritime economy to develop. After the Treaty of Templin in 1317 the city passed to the Duchy of Pomerania-Wolgast. In 1368 Pomerania-Stolp (Duchy of Słupsk) was split off from Pomerania-Wolgast due to the Partitions of the Duchy of Pomerania. The grandson of Polish King Casimir III the Great and his would-be successor Casimir IV became duke of Słupsk as a Polish vassal in 1374, after he failed to take the Polish throne. The succeeding dukes were also vassals of the Kings of Poland: Wartislaw VII paid homage in 1390 (to King Władysław II Jagiełło), Bogislaw VIII paid homage in 1410 (also to King Władysław II). Słupsk remained within Polish sphere of political influence until 1474. It became part of the Duchy of Pomerania in 1478. Modern ages The Protestant Reformation reached the town in 1521, when Christian Ketelhut preached in the town. Ketelhut was forced to leave Stolp in 1522 due to an intervention by Bogislaw X, Duke of Pomerania. Peter Suawe, a Protestant from Stolp, however, continued his practices. In 1524, Johannes Amandus from Königsberg and others arrived and preached in a more radical way. As a consequence, Saint Mary's Church was profaned, the monastery's church was burned, and the clergy were treated poorly. The inhabitants of the town began the process of conversion to Lutheranism. In 1560 Polish pastor Paweł Buntowski preached in