During the Kalmar Union (1397–1523), controlling Stockholm was crucial to anyone aspiring to control the kingdom, and the city was consequently repeatedly besieged by various Swedish-Danish factions. In 1471, Sten Sture the Elder defeated Christian I of Denmark at the Battle of Brunkeberg only to lose the city to Hans of Denmark in 1497. Sten Sture managed to seize power again in 1501 which resulted in a Danish blockade lasting 1502–1509 and eventually a short peace. Hans' son Christian II of Denmark finally conquered it in 1520 and had many leading nobles and burghers of Stockholm beheaded in the so-called Stockholm Bloodbath. When King Gustav Vasa finally besieged and conquered the city three years later, an event which ended the Kalmar Union and the Swedish Middle Ages, he noted every second building in the city was abandoned.