The Treaty of Gotland (Swedish: Gotländska freden) was a peace treaty settled by the Swedish king Magnus III to resolve a conflict between the peasants of the Swedish island Gotland, and the burghers of the island’s largest city, Visby. The conflict is believed to have stemmed from rivalry over the lucrative Gutnish trade on the Baltic sea and disagreement between the two factions over duties levied by the burghers on all goods entering Visby. The peasants were aggrieved over the new duties that had been introduced in 1288, after completion of the City wall of Visby. Many of the Visby burghers were Germanic tradesmen associated with what would eventually become the Hanseatic League.
The burghers prevented the peasants from traveling to the mainland to protest to the king, and soon open hostilities broke out. A battle was fought at Högebro, where the burghers emerge victorious thanks to their superior armament. The peasants did not give up, however, and a new battle was fought at the Monastery of Roma, where neither faction emerged victorious.
The priests of the island now intervened, trying to bring about conciliation between the parties. They succeeded in securing a fragile peace.
When King Magnus received word of the conflict, he summoned representatives of the fighting parties to Nyköping in August 1288 and condemned the burghers to pay 2.000 mark silver of Gutnish standard and 500 marks assorted silver, as penance for their deeds. Magnus also stipulated that future conflicts should be settled by him, and that the peasants should not be prevented from making complaints to the king. Magnus also entered into an agreement with the city of Visby, which in principle stated that only the Swedish king should be the master of Gotland.
The Swedish king had long been wanting to expand eastward and gain a larger share of the lucrative trade on the Baltic Sea. The conflict provided a golden opportunity to strengthen his power over Gotland, which until then had enjoyed a large measure of autonomy.