The oldest part of the city wall is a defensive tower, today called the Kruttornet (the Gunpowder Tower), which was erected at the harbor entrance in the 12th century, making it the oldest surviving non-religious building in the Nordic countries.
[5] It was not until the 1270s and 1280s, that the building of a proper defense for the town of Visby started, with the erection of the land-facing wall.
[8] The construction of the wall was probably connected to conflicts that arose between the town of Visby and the thing or assembly of Gotland, which led to a civil war on the island in 1288.
A part of the wall east of Kvarntornet (the Mill Tower) which has been razed possibly dates from the beginning of this war, when Visby was captured and plundered.
When King Valdemar IV of Denmark captured the town in 1361, he ordered a part of the wall to be torn down as a symbolic act.
[11] The corner tower known as the Silverhättan (the Silver Cap) probably dates from the period in which Visby belonged to the Teutonic Knights (1398–1408).
When domestic tolls were abolished in Sweden in 1810, the city wall was already a known landmark, which guaranteed its survival.
[19] The wall encloses the old town of Visby which is built on a steep slope facing the Baltic Sea.
To the north and south the wall climbs the slope known as the Klinten, towards the east where the highest elevation reaches about 40 metres (130 ft).