In the middle of the 14th century, Sweden was struck by the Black Death. The population of Sweden and most of Europe was decimated. The population (at same territory) did not reach the numbers of the year 1348 again until the beginning of the 19th century. One third of the population died in the triennium of 1349–1351. During this period, the Swedish cities began to acquire greater rights and were strongly influenced by German merchants of the Hanseatic League, active especially at Visby. In 1319, Sweden and Norway were united under King Magnus Eriksson, and in 1397 Queen Margaret I of Denmark effected the personal union of Sweden, Norway, and Denmark through the Kalmar Union. However, Margaret's successors, whose rule was also centred in Denmark, were unable to control the Swedish nobility.