Słupsk had its origins as a Pomeranian settlement in the early Middle Ages. In 1265 it was given town rights. By the 14th century, the town had become a centre of local administration and trade and a Hanseatic League associate. Between 1368 and 1478, it was the residence of the Dukes of Słupsk, until 1474 vassals of the Kingdom of Poland. In 1648, according to the peace treaty of Osnabrück, Stolp became part of Brandenburg-Prussia. In 1815 it was incorporated into the newly formed Prussian Province of Pomerania. After World War II, the city again became part of Poland, as it fell within the new borders determined by the Potsdam Conference.