The settlement dates back to the 10th century. Together with Pomerania it formed part of Medieval Poland and as a result of the 12th-century fragmentation of Poland it became part of the separate Duchy of Pomerania, ruled by the House of Griffin. Barnim I, Duke of Pomerania granted the settlement Madgeburg town rights and additional privileges in 1264, yet the town was rechartered with Lübeck Law, which favoured the local merchants, in 1314. The town grew by exploiting the vast timber reserves in the town-owned forests, and by trade. The town was connected to the Baltic Sea trade routes by the port of Inoujście at the mouth of the Ina river. Competition with nearby Szczecin ("Stettin") led to a series of conflicts between the two towns, the differences were set aside only in 1615 when the towns signed a reconciling treaty. The town remained part of the Duchy of Pomerania until Sweden took over in 1630.