quality:correction, structural:reformatting, linguistic:translation
Teutonic Knights

In 1308, the town was taken by Brandenburg and the Teutonic Knights restored order. Subsequently, the Knights took over control of the town. Primary sources record a massacre carried out by the Teutonic Knights against the local population, of 10,000 people, but the exact number killed is subject of dispute in modern scholarship. Multiple authors accept the number given in the original sources, while others consider 10,000 to have been a medieval exaggeration, although scholarly consensus is that a massacre of some magnitude did take place. The events were used by the Polish crown to condemn the Teutonic Knights in a subsequent papal lawsuit.

The knights colonized the area, replacing local Kashubians and Poles with German settlers. In 1308, they founded Osiek Hakelwerk near the town, initially as a Slavic fishing settlement. In 1340, the Teutonic Knights constructed a large fortress, which became the seat of the knights' Komtur. In 1346 they changed the Town Law of the city, which then consisted only of the Rechtstadt, to Kulm law. In 1358, Danzig joined the Hanseatic League, and became an active member in 1361. It maintained relations with the trade centres Bruges, Novgorod, Lisboa, and Sevilla. Around 1377, the Old Town was equipped with city rights as well. In 1380, the New Town was founded as the third, independent settlement.

After a series of Polish-Teutonic Wars, in the Treaty of Kalisz (1343) the Order had to acknowledge that it would hold Pomerelia as a fief from the Polish Crown. Although it left the legal basis of the Order's possession of the province in some doubt, the city thrived as a result of increased exports of grain (especially wheat), timber, potash, tar, and other goods of forestry from Prussia and Poland via the Vistula River trading routes, although after its capture, the Teutonic Knights tried to actively reduce the economic significance of the town. While under the control of the Teutonic Order German migration increased. The Order's religious networks helped to develop Danzig's literary culture. A new war broke out in 1409, culminating in the Battle of Grunwald (1410), and the city came under the control of the Kingdom of Poland. A year later, with the First Peace of Thorn, it returned to the Teutonic Order.