Gdańsk (; ) is one of the oldest cities in Poland. Its history begins with an early medieval settlement at the mouth of the Vistula River. A fortified center had been established by the late 10th century, possibly during the expansion of the Piast state under Mieszko I. The city remained part of the Piast state, either directly or as a fief, until the early 13th century, when it came under the rule of the Samborides, who governed Pomerelia as autonomous dukes from 1227.

In 1308 the city became part of the Monastic State of the Teutonic Knights until 1454. Thereafter it became part of Poland again, although with increasing autonomy. A vital naval city for Polish grain trade, it attracted people from all over the European continent. After a period of decline, the city was taken over by Prussia during the Second Partition of Poland in 1793 and subsequently regained its importance as a trading port. Briefly becoming a free city during the Napoleonic Wars, it became again part of the Prussian kingdom after Napoleon's defeat, and from 1871 it formed part of the newly created German Empire. After World War I, the Free City of Danzig was created, a city-state under the supervision of the League of Nations. The German attack on the Polish military depot at Westerplatte marked the start of World War II and the city was annexed by Nazi Germany in 1939.

After World War II, the city again became part of Poland, and the city's German inhabitants, who had constituted the majority of the city's mixed population before the war, either fled or were expelled to Germany. During the post-1945 era, the city was rebuilt from war damage, and vast shipyards were constructed. The city was a centre of Solidarity strikes in the 1980s, and after the abolishment of communism in 1989, its population faced poverty and widespread unemployment with most of the ship building industry closed down.

History

Early times

The area around the Vistula delta was inhabited by populations belonging to the various archaeological cultures of the Stone Age, Bronze Age, and Iron Age. Settlements existed in the area for several centuries BC.

Foundation in early Polish state

Most likely Mieszko I of Poland founded the town in the 980s, thereby connecting the Polish state ruled by the Piast dynasty with the trade routes of the Baltic Sea. The earliest traces of medieval settlement were discovered in an area now occupied by the town hall of the Main Town, on top of archaeological remains from the Roman Iron Age. The oldest constructions of this settlement were built, according to dendrochronology, with timber from trees cut in 930. The immediate western vicinity of the town hall has, however, so far not been surveyed, thus it can not be excluded that the settlement extended further to the west. Dendrodates exclusively refer to the 10th century, no constructions from the 11th century were found. The very beginning of Gdańsk is related to the fall of Truso in the second half of the 10th century - the Viking Age Emporium situated on eastern side of the Vistula delta. Only after this town declined, it was eclipsed as a trade centre by nearby Gdańsk.

In the area south of the current St. Nicholas’ Church, settlement started some years later. The oldest constructions there were dated by finds of pottery to either the second half of the 10th century or the turn of the 10th to the 11th century. The first written record thought to refer to Gdańsk is the vita of Saint Adalbert: Written in 999, it describes how in 997 Saint Adalbert of Prague baptized the inhabitants of urbs Gyddannyzc, "situated on the edge of the vast state [Duchy of Poland] and touching the seashore."

In the area of the current Great Mill the oldest settlement layers were dated by finds of pottery to the 11th century or the turn of the 12th. Though the area between St. Nicholas’ Church and the Great Mill has not yet been sufficiently surveyed, it has been suggested by Paner that in the course of the 11th century the settlement just south of St. Nicholas’ was expanded to the northwest to reach the vicinity of the Great Mill and, possibly, the area around St. Catherine’s church. In the northern vicinity of St. Nicholas’, in the area of the current market hall, settlement then started probably in the 12th century. , archaeologists have not been able to find traces of fortifications around the before mentioned settlement(s).

Slightly east of the Great Mill, at the banks of the Motława river, a stronghold was built in the 1060s. This stronghold encompassed roughly the area now enclosed by the Rycerska and Sukiennicza streets, and in the 11th century was located at the confluence of the Motława and Vistula rivers. The stronghold consisted of a fort and a suburbium covering 2.7 ha which may have held 2,200 to 2,500 inhabitants.Loew, Peter Oliver: Danzig. Biographie einer Stadt, Munich 2011, p. 27. Timber from trees cut between 1054 and 1063 was used for buildings of the first phase of the stronghold's construction, timber from trees cut around 1090 was used to construct the buildings of the subsequent phase. A first rampart enclosing the stronghold was built with timber from trees cut in the 1060s. Starting in 1112, according to dendrodates, the stronghold was first leveled and subsequently transformed. This corresponds with written sources mentioning the subduction of Pomerelia by Piast Polish king Boleslaw III Wrymouth between 1112 and 1116. The youngest examined layers from which dendrodates could be derived point at around 1135.

Starting in the mid-12th and throughout the 13th centuries, the settlement west of the stronghold greatly expanded northwards to comprise the wider area around present-day Rajska and Podbielanska streets in the Old Town. In the southern part of the settlement, in the area now occupied by the market hall, a Romanesque St. Nicholas church was built in the second half of the 12th century, which according to Paner "was probably the second masonry church in Gdansk, after the stronghold's church" and was replaced by another Romanesque St. Nicholas church built in 1223-1241 by the Dominicans, who owned the area since 1227. In 1168, the Cistercians built a monastery in nearby Oliwa (northwest of the town) which is inside the modern city limits. A parochial St. Catherine church is first mentioned in written records in the second half of the 13th century, situated in the new centre of the expanded settlement.

+ Historical population Year Population c. 1000 1000 1235 2,000 1600 40,000 165070,000 170050,000 175046,000 179336,000 180048,000 182561,900 184065,000 185267,000 187490,500 188013,701 1885108,500 1900 140,600 1910 170,300 1925 210,300 1939 250,000 1946 118,000 1960 286,900 1970 365,600 1975 421,000 1980 456,700 1994 464,000 2002 460,000 2019 470,904

Capital of a Pomerelian Duchy (1215–1271)

At the end of the 11th century Poland lost control over Pomerelia and did not regain it until the 12th century. Soon after Poland itself was divided into several autonomous provinces formally under the overlordship of the High-Duke of Kraków. The Pomerelian duchies remained under the control of stewards, of the Samborides dynasty, appointed by Polish Dukes, usually those of Greater Poland, although like other Polish provinces during the period of the fragmentation of Poland it increased its regional autonomy. Gdańsk was the main stronghold of Samborides, serving as residence of Mestwin I (1207–1220), Swietopelk II (1215–1266) and Mestwin II (1271–1294).

In 1226, the monastery in Oliwa was raided by pagan Old Prussians.

Around 1224 the settlement had some 2,000 inhabitants and was granted Lübeck city rights by Swietopelk II, after merchants from the Hanseatic cities of Lübeck and Bremen had begun to settle there. It rose to become one of the more important trading and fishing ports along the Baltic Sea coast. However, in 1282/1294 Mestwin II, the last duke of Pomerelia, ceded all his lands including Gdańsk to Przemysł II, Duke of Greater Poland, who soon became King of Poland, thus it was reunited with the Kingdom of Poland.

Monastic State of the Teutonic Knights (1308–1454)

At the beginning of the 14th century, the region was plunged into war involving Poland and the Margraviate of Brandenburg. Because King Władysław I of Poland's troops were unable to relieve Gdańsk from a siege by Brandenburg, the city's Pomeranian judge, Bogusza, appealed to the Teutonic Knights for assistance.Gieysztor, Alexander, Stefan Kieniewicz, Emanuel Rostworowski, Janusz Tazbir, and Henryk Wereszycki. History of Poland. PWN. Warsaw, 1979. Subsequently, the Teutonic Order massacred not only the Brandenburg forces and the Pomeranian knights who supported them, but also the town's inhabitants. The royal garrison was attacked and expelledHalecki, Oscar. A History of Poland. Roy Publishers. New York, 1976. and the suburban populace was slaughtered, with the suburbs subsequently destroyed. Gdańsk's colony of German merchants and artisans was specifically attacked because they competed with the Knights' town of Elbing (Elbląg), a nearby city.Urban, William. The Teutonic Knights: A Military History. Greenhill Books. London, 2003. Śliwiński & Możejko (2017) give the estimated number of victims as approximately 1,000. According to Smoliński (2021), the death toll is estimated to lie between 60 and 150.

The Teutonic Knights incorporated the town into their monastic state and instructed the remaining burghers to depart. In 1308, they founded Osiek Hakelwerk near the town, initially as a Lechitic fishing settlement.

The Knights then captured the rest of Pomerelia from Brandenburg's troops. In September 1309, Margrave Waldemar of Brandenburg-Stendal sold his claim to the territory to the Teutonic Order for 10,000 marks, thereby connecting the Order's territory with that of the Holy Roman Empire.

The Order did not rebuild the town until the mid-1320s, when some of its former inhabitants—primarily Lübeckers, who also brought back the pre-1308 town seal—returned, alongside settlers from other German regions. The town saw a rapid rise in population and became almost completely German; it would become primarily known by its German name, . In 1340, the Teutonic Order constructed a large fortress, the Gdańsk Castle, which became the seat of the knights' Komtur.

The takeover of Gdańsk by the Teutonic Order was questioned consistently by the Polish kings Władysław and Casimir III the Great, which led to a series of bloody wars and legal suits in the papal court in 1320 and 1333. After a series of Polish–Teutonic Wars, King Casimir of Poland recognized the Teutonic Order’s possession of Danzig and Pomerelia in the Treaty of Kalisz (1343), Although the Polish kings were able to retain the title "Duke of Pomerania" and were recognized as titular overlords of the crusaders, the Knights retained control of Danzig for the time being.

In 1346, Teutonic Order 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, Lisbon, and Seville. Around 1377, the Old Town was equipped with city rights as well. In 1380, the New Town was founded as the third, independent settlement. Urban growth was mainly driven by migration from German-speaking lands.

In 1380, the first Scots settled in the city, founding what would eventually become a significant Scottish diaspora in Poland.

In 1410, during the Polish–Lithuanian–Teutonic War the city's council recognized the Polish king, Władysław Jagiełło as its sovereign. After the end of the war, concluded with the Peace of Toruń in 1411, Jagiełło relieved the city of its oath of fealty and it reverted to Teutonic rule. Subsequently, the city's populace was repressed by the Teutonic Knights as punishment for its support of the Polish king.