The island town at the outlet of Lake Mälaren that Birger Jarl is credited with founding in the 1250s: Sweden's largest medieval town, the port for Bergslagen iron and copper, and the prize every party of the Kalmar Union era had to hold, from the Käpplinge murders of 1389 to Brunkeberg in 1471.
Stockholm stands on a cluster of islands in the narrow channel through which Lake Mälaren empties into Saltsjön, the arm of the Baltic reaching in from the archipelago. Whoever held the channel controlled shipping to and from the Mälaren towns of Västerås, Arboga and Köping, the outlets of the Bergslagen mines, and the route to Uppsala, seat of Sweden's archbishop. The town first appears in two Latin letters issued by Birger Jarl in 1252, and by 1300 it was the largest town in Sweden.
Its medieval history is the history of that position. German merchants, many from Lübeck, dominated its trade and for long held half the seats on its council, and every king and regent of the Kalmar Union period, from Albert of Mecklenburg to Christian II of Denmark, had to take or keep Stockholm castle to rule the kingdom.
The name means something like 'log islet' and has no agreed explanation; the most favoured one points to wooden piles driven into the strait north of the island, which tree-ring dating in the late 1970s placed around the year 1000. The older centres of the Mälaren region, Birka and then Sigtuna, had faded, and a note in the Visby chronicle ties Stockholm's founding to the sack of Sigtuna by eastern raiders in 1187, but that note was written down only around 1410 and is doubted.
The first secure record is a pair of letters issued by Birger Jarl in 1252, one in July protecting the convent at Fogdö and one dated 19 August ordering the people of Attundaland to pay tithe to Uppsala Cathedral. Neither describes the place. The rhymed Erikskrönikan, written in the 1320s, says Birger built Stockholm as a lock to shut the rich Mälaren country against pirates and enemy fleets from the Baltic. Historians still disagree whether the island was mostly farmland in 1250 and grew fast around the new castle or was already a trading place, but commercial treaties with Lübeck in the 1250s and Hamburg in 1261 show that German merchants were wanted there from the start.
The castle began as a tower on the northern high point of the island inside a simple wall and grew over two centuries into the royal castle later called Tre Kronor, after the three crowns on its keep; when the crowns were first put there is not known. Birger's son Magnus III of Sweden, Magnus Ladulås, patronised the Franciscans on the islet west of the town, long called Gråmunkeholmen, Greyfriars Islet, and in 1288 gave them another island from which they cut timber for their church. He was buried in that church in 1290, and parts of it, now Riddarholmen Church, are among the oldest standing buildings in Stockholm.
The town church, dedicated to Saint Nicholas, patron of Baltic seafarers, is first recorded in 1279 and was consecrated in 1306; as Storkyrkan it remained Stockholm's only parish church until the 1590s. Magnus Eriksson and his queen Blanche of Namur made a gift to it in 1346 that probably paid for its first side chapel, and in 1336 he gave the Dominicans the old tower at the island's southern tip, where their Blackfriars convent was consecrated in 1343. In the early fourteenth century the town also won a staple right: goods from Roslagen and the whole Gulf of Bothnia, the furs, hides and fish of Norrland and Finland, could be sold only in Stockholm.
When Swedish nobles turned against Magnus Eriksson and brought in his nephew Albert of Mecklenburg in 1364, Stockholm, with its large German population, welcomed the new king, and in 1371 it held out when Haakon VI of Norway besieged it. Albert later lost the Swedish nobility, and in February 1389 the army of Margaret I of Denmark defeated and captured him at Åsle, but Stockholm stayed in the hands of his German partisans.
The town's law gave its German community an extraordinary place. The council was by statute half German and half Swedish, merchants filled nearly every seat, craftsmen were occasionally given minor duties and the rest of the townspeople had no voice. The German merchants lived above all around the grain harbour and the iron market at the island's southern end, where boats from Mälaren unloaded and seagoing cogs loaded for Lübeck and Danzig.
After Åsle that balance broke. In June 1389 members of the German faction called the Hättebröder, the hooded brothers, shut about seventy men of the Swedish party in a barn on the islet of Käpplingeholmen and burned them alive. Margaret's forces blockaded the town, and from 1392 the dukes of Mecklenburg licensed privateers, the Victual Brothers, to run provisions through; they soon turned to piracy across the whole Baltic. The settlement that freed Albert in 1395 gave him three years either to surrender Stockholm or to pay Margaret a large sum, with the Hanseatic towns holding the town as security in the meantime; he chose to give it up, and it passed to Margaret in 1398, the year after her great-nephew Eric of Pomerania was crowned king of the three kingdoms at Kalmar.
Under the union the castle was a royal fortress held by the king's bailiffs, and the timber town burned often: a fire in the early fifteenth century swept the market place, which was then enlarged, and the town hall on its north side was rebuilt after a fire in 1419. Eric of Pomerania's taxes and his long war with Holstein, which hurt the export of Bergslagen iron, provoked the rising led by the mine-owner Engelbrekt Engelbrektsson from 1434. In April 1436 a rebel force marched on Stockholm, where Eric still had support, and in May Engelbrekt was murdered by a personal enemy.
On 1 May 1436 the council of the realm granted Stockholm a letter of privileges for the loyalty and service its council and commons had shown the realm, the oldest surviving grant of the town's liberties and often taken as the start of its role as capital. Karl Knutsson Bonde, who took over the leadership of the rising, was elected king in June 1448 and ruled as Charles VIII of Sweden. A Danish fleet failed to take the town in 1452. Driven out in 1457, when the rebel leaders had Christian I of Denmark elected in Turku and then in Stockholm, Charles came back in 1464 and again in 1467, died in Stockholm on 15 May 1470 and was buried in the Greyfriars church.
Charles left his nephew Sten Sture in charge of his lands, including Stockholm and its castle, and a meeting at Arboga elected Sture regent on 1 May 1471. Christian I sailed to Stockholm, anchored off Skeppsholmen and camped on the Brunkeberg ridge north of the town. On 10 October 1471 Sture attacked from the west, his kinsman Nils Bosson Sture from the east and Knut Posse from the town itself. Christian was hit in the face by a handgun shot, a detachment of his army was cut off at the convent of Saint Clare, and many of his men drowned when their makeshift bridge to Käpplingeholmen was broken. Most of the men on both sides were Swedes, and the quarrel was as much about the Bergslagen trade with Lübeck as about Danish rule.
The victory secured Sture's regency for a quarter of a century. Tradition says he had prayed to Saint George before the battle, and he commissioned a monumental oak group of Saint George and the Dragon for Storkyrkan, unveiled in 1489 and widely attributed to Bernt Notke of Lübeck, which was also to be the tomb monument of Sture and his wife. In the same years Storkyrkan was rebuilt: between the 1470s and 1496 its chapels were joined into aisles under new high vaults and the church was lengthened to the east, reaching the size it still has. In 1483 the printer Johann Snell, brought from Lübeck, produced in Stockholm the first book printed in Sweden, the Dialogus creaturarum.