Visby was a town with a lot of German influence. From early on the town had German laws. Due to its central position in the Baltic Sea, Visby came to play a major role in the trade between northern Germany and the Baltic states. For a period in the 14th century, Visby was the central town of the Swedish-Livonian branch of the Hanseatic League.
The citizens of Visby did not get on well with the people who lived in the country-side. This was above all due to the fact that the citizens traded more than the peasants in the country. Towards the end of the 13th century, a town wall was built to protect the town from peasant attacks. In 1288, a war broke out between town and country-side, which was won by the town.
In 1361, Visby was conquered by the Danish King, Valdemar Atterdag, who defeated a peasant army just outside the town wall. In 1398, Gotland was taken by the Teutonic Knights. Denmark bought the town back, as well as the island of Gotland for a large sum of money, in 1408. Gotland remained Danish until the peace at Brömsebro in 1645.
Large parts of medieval Visby are preserved. There is the town wall from the 13th century, and Mary’s Church, which now is the cathedral of the diocese of Visby. But there are also a number of town houses, as for example the Burmeister House and the old pharmacy.