Before Gdansk was established the vicinity was inhabited by the populations belonging to the various archealogical cultures of the Stone Age, Bronze Age and Iron Age.
Gdansk was surrounded by the Prussian territories until 1793, when it was incorporated into the Prussian kingdom as part of the province of West Prussia, reverting under Napoleon Buonaparte to direct Prussian rule after a second brief period (1807-14) as a free city.
A list of the 173 mayors of the City of Gdansk from 1347 to March 1945 was compiled by the current Gdansk city government and can be found on their recent website with the invitation for a reunion meeting of Gdansk at the "First World Gdańsk Reunion", which took place in May 2002.
The first written record seems to be the Index List of property given to the pope by Oda von Haldensleben and her husband mentioned as Dagome (who is most probably identical with Mieszko), known from summary made by a monk in the 11th century and herein mentioned as Dagome Iudex.
On numerous occasions Poland's existence as a country was endangered, first, when the Polanian dukes tried to conquer lands in the 10th-13th centuries from Bohemia (Czechs), from Pomeranian, Prussian and Germans, and later, in the 17th century and afterwards, by Swedes, Russians, Prussians and Austrians.
Lands under Duke Mieszko's rule as vassal of the emperor and as margrave encompassed Greater Poland, Lesser Poland, Silesia and Pomerania.