Visby is a locality and the seat of Gotland Municipality in Gotland County, on the island of Gotland, Sweden. Visby is also the episcopal see for the Diocese of Visby. The Hanseatic city of Visby is arguably the best-preserved medieval city in Scandinavia and since 1995, it is on the UNESCO World Heritage Site list. Among the most notable historical remains are the 3.4 km long town wall that encircles the town center, and a number of church ruins.
Visby is a popular vacation destination for Scandinavians during the summer and receives thousands of tourists every year. It is by far the most populated locality outside the Swedish mainland. The University of Gotland is in Visby, and since 1 July 2013, it is a department of Uppsala University under the name Uppsala university - Campus Gotland. Visby is also the sole county seat in Sweden only accessible by boat and air.
The earliest history of Visby is uncertain, but it is known to have been a centre of merchandise around 900 AD. It was inhabited as early as the Stone Age, probably because of the access to fresh water and a natural harbour.
In the 12th century, Visby Cathedral, dedicated to Saint Mary, was constructed. It was reshaped in the 13th century to its current appearance, and was officially opened in 1225, by the bishop of the Swedish city of Linköping. Several other churches were also constructed in the ensuing centuries. The city flourished, thanks to the German Hanseatic League.
The work on the ring wall was likely begun in the 12th century. Around 1300, it was rebuilt to reach its current height, acquiring the characteristic towers, although some towers were not constructed until the 15th century. The ringwall is still largely intact.
In the first half of the fourteenth century (1300-1350) Visby was at the height of its wealth and influence, and it was during this time that Laws of Wisbuy, a set of maritime laws that had broad influence in the Baltic and beyond, were probably promulgated.
In 1361, Gotland was conquered by Valdemar IV of Denmark. 1,800 Gotlanders were killed in battle in front of the city. Valdemar tore down part of the wall, set up three huge beer barrels and threatened to turn his men loose to pillage the town unless they were filled with silver and gold. The Visby city fathers fulfilled the demand, with churches stripped of their valuables. Valdemar added "King of Gotland" to his title list. His treatment of Visby, a member of the Hanseatic League, precipitated that League into war with Denmark; however, though Valdemar was forced into various concessions, he retained Visby as a Danish city.
In 1391, 1394 and 1398, it was taken and plundered by the Victual Brothers, pirates who sailed the Baltic Sea. An invading army of Teutonic Knights conquered Gotland in 1398, destroyed Visby and expelled the Victual Brothers. In 1409, Grand Master Ulrich von Jungingen of the Teutonic Knights guaranteed peace with the Kalmar Union of Scandinavia by selling the island of Gotland to Queen Margaret of Denmark, Norway and Sweden.
In 1411, the Norwegian, Danish and Swedish King Eric of Pomerania had the castle of Visborg constructed, and settled himself there for twelve years, during which the city virtually became a pirates' nest, and the commerce halted. As of 1470, the Hanseatic League rescinded Visby's status as a Hanseatic town.
In 1525, the final blow came. In the Danish throne quarrel, the Lübeck, a Free City of the Holy Roman Empire and a leading member of the Hanseatic League, supported Frederick I, while Søren Norby the Danish governor of Gotland fought for Christian II, even after Christian's official resigniatio in 1523. While Norby fought a military action in Sweden, the Lübeckers successfully attacked Visby and set the city on fire from four sites. But unlike widespread belief, several churches survived for first. The churches of St. James, St. Nicholas and St. Gertrude were sacked by Lubeck's army. With the reformation, all churches except St. John, which became the city parish, were closed. In 1528, the citizens of Visby sacked the ruler's church in revenge for the plundering of their town. In 1533–34, the new Danish governor, Henrik Nielsen Rosenkrantz, demolished St. John's and St. Peter's churches to improve the defence of his castle Visborgs slott. St. Mary's Cathedral remained the last functional church and became the new city parish. Though the destruction of the churches of visby happened more than 480 years ago, some of them are still in a better stage, than many Polish and German churches that meanwhile have been reconstructed were in the end of World War II.
Gotland was again taken into Sweden's possession in 1645, by the Treaty of Bromsebro, after 300 years of Danish rule. The city developed slowly as things were left as they were. In the mid 18th century, after a plague had reduced Visby's population, some attempts were made by Swedish government officials to improve living standards, but little was accomplished. Not until the early 19th century did Visby once again attract commerce and a harbour industry. At the same time – 1808 – Gotland was conquered by Russia, but was peacefully taken back by the Swedes after only a couple of months.