Signs of settlement dating back to the Roman Empire era have been found.
In the early Middle Ages, a fortified settlement of the Old Prussians existed at the site, conquered by the Teutonic Knights in 1236.
The castle was captured by the Poles after the Battle of Grunwald in 1410.
Town rights were granted to the settlement in 1416 and confirmed by King Sigismund II Augustus in 1553.

In 1441 the town joined the Prussian Confederation, which opposed Teutonic rule, and upon the request of which King Casimir IV Jagiellon incorporated the territory to the Kingdom of Poland in 1454.
The castle, which initially remained in the hands of the Teutonic Knights, was captured by Poles after a siege in 1454, but later it was taken over by the Teutonic Knights again.
In 1466 by the Second Peace of Toruń the town was finally renounced by the Teutonic Knights and integrated with the Kingdom of Poland.
As part of Poland, the town functioned as a seat of the Sztum County in Malbork Voivodeship (1466-1772) and a place to hold the voivodeship's sejmiks (regional court sessions).
The Sztum Castle was the seat of the local starosts.
In 1635 the Treaty of Stuhmsdorf between the Poland and Sweden was signed in the village of Stuhmsdorf/Sztumska Wieś, just south of Sztum.

In 1772 as a result of the First Partition of Poland the town was annexed by the Kingdom of Prussia.
In 1871 it became part of the newly created German Empire.

According to the Treaty of Versailles, after World War I the inhabitants of the town and its district were asked whether they want to remain in Germany or join the new Second Polish Republic in the East Prussian plebiscite of 1920.
Ultimately, in Stuhm 2,079 votes were counted to remain in Germany and 751 votes for Poland.
Based on that result Stuhm was included in the Regierungsbezirk Marienwerder within East Prussia.
In the interwar period, Sztum remained one of the main centers of the Polish community in the area.
The Germans arrested 30 local Polish activists in August 1939, before the invasion of Poland.

After World War II Sztum became again part of Poland, under territorial changes demanded by the Soviet Union at the Potsdam Conference.
Signs of settlement dating back to the Roman Empire era have been found. In the early Middle Ages, a fortified settlement of the Old Prussians existed at the site, conquered by the Teutonic Knights in 1236. The castle was captured by the Poles after the Battle of Grunwald in 1410. Town rights were granted to the settlement in 1416 and confirmed by King Sigismund II Augustus in 1553.
In 1441 the town joined the Prussian Confederation, which opposed Teutonic rule, and upon the request of which King Casimir IV Jagiellon incorporated the territory to the Kingdom of Poland in 1454. The castle, which initially remained in the hands of the Teutonic Knights, was captured by Poles after a siege in 1454, but later it was taken over by the Teutonic Knights again. In 1466 by the Second Peace of Toruń the town was finally renounced by the Teutonic Knights and integrated with the Kingdom of Poland. As part of Poland, the town functioned as a seat of the Sztum County in Malbork Voivodeship (1466-1772) and a place to hold the voivodeship's sejmiks (regional court sessions). The Sztum Castle was the seat of the local starosts. In 1635 the Treaty of Stuhmsdorf between the Poland and Sweden was signed in the village of Stuhmsdorf/Sztumska Wieś, just south of Sztum.
In 1772 as a result of the First Partition of Poland the town was annexed by the Kingdom of Prussia. In 1871 it became part of the newly created German Empire.
According to the Treaty of Versailles, after World War I the inhabitants of the town and its district were asked whether they want to remain in Germany or join the new Second Polish Republic in the East Prussian plebiscite of 1920. Ultimately, in Stuhm 2,079 votes were counted to remain in Germany and 751 votes for Poland. Based on that result Stuhm was included in the Regierungsbezirk Marienwerder within East Prussia. In the interwar period, Sztum remained one of the main centers of the Polish community in the area. The Germans arrested 30 local Polish activists in August 1939, before the invasion of Poland.
After World War II Sztum became again part of Poland, under territorial changes demanded by the Soviet Union at the Potsdam Conference.
Sztum