The city wall of Visby
The Gotland farmers had traded across the Baltic Sea for several hundred years. Many of them became rich.
The 1100s saw the rise of the north German-funded trade organisation known as the Hanseatic League. Visby became an important Hanseatic town, where people from many different countries met. In the 1270s, a wall was built around the increasingly wealthy town; partly as protection against attacks, partly so that the citizens could charge a toll to the farmers when they came to sell their goods. But there was another reason for building the wall. It was intended to exclude farmers from the lucrative trade with foreign countries.
This led to war breaking out in 1288 between rural communities and Visby; a war which the town won. The wall was built even higher.
Following the war, Gotland was divided. The farmers were almost independent but paid low taxes to the Swedish king. Visby lived its own life, under the laws and terms of the Hanseatic League. The antagonism between town and country remained.