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.