The Later Middle Ages
At the beginning of this period, Sweden was exclusively a Baltic country. It did not include the southern part of the Scandinavian peninsula, which was held by the Danes. Despite wars between rival houses for the Swedish throne, lasting more than 100 years in the 12th and 13th centuries, the kingdom became more firmly established. Finland was incorporated into the kingdom beginning in the 12th century. In the late 12th or early 13th century, the capital city of Stockholm was founded. Also during the 13th century, the laws of the various Swedish provinces were codified. A century later, a national code was written, based on the provincial laws. It laid down the respective powers of the king, his council of nobles, and the people.
Sweden established commercial ties with the trading cities of western Europe through the Hanseatic League. The town of Visby on the island of Gotland became one of the main trade centers of the League. By the end of the 14th century, north German cities began to monopolize Baltic trading. In 1397 the Scandinavian countries (Sweden, Norway, and Denmark) formed the Union of Kalmar, a kingdom united under one monarch to combat the growing strength of the Germans. However, Swedish resentment rose over Danish domination of the union, and there followed a century of strife between Sweden and Denmark and within Sweden itself.
In 1434 Engelbrekt Engelbrektsson, a mine owner, led an uprising against the union and gained a popular following. In 1435 he called an assembly, the first riksdag (parliament), which included representatives of the peasantry. Engelbrekt was murdered in 1436, but uprisings continued. However, independence was not won until the successful revolt of 1521–23, led by Gustavus Eriksson Vasa.

