Prehistory and origin of Stockholm
According to the Chronicle of Eric, written in the 1320s, Stockholm was founded by Birger Jarl around 1250 as a lock to the Lake Mälaren region ("laas fore then sio", "lock before that lake") in order to prevent pirates from reaching the seven cities and nineteen parishes around it. Another medieval source ("Visbyannalerna"), however, claims the city was founded in 1187 following a pagan pillaged the city of Sigtuna, and as there was an "Earl" named Birger around at that time too, the disputed origin of the city are likely to remain obscure and some historians choose a diplomatic interpretation saying there was some sort of fortification around by the mouth of lake Mälaren when the city was founded during the second half of the 13th century. As Snorri mentions no city in his account but some sort of fortification called a "kastali" (in various manuscripts curiously said to be located east and west of "Stocksund"), it has generally been assumed this fortification eventually developed into the castle Tre Kronor located where still is the Stockholm Palace.
Stockholm during the Swedish Empire
In this context, Stockholm was of central importance. In a letter in 1636, Chancellor Axel Oxenstierna (1583–1654), the main architect behind the Swedish central government, wrote that evolving the Swedish capital was a prerequisite for the nation's "power and strength" ("rijksens machtt och styrke"); that all efforts should be made to ensure "Stockholm arose and that it became populated" ("Stockholm kommer opp och den bliffver populerat"); and that this would "certainly bring all the other cities on their feet" ("Sedan skall väll Stockholm bringa dee andre på behnen"). Increased state intervention on city level was not unique to Sweden at this time, but it was probably more prominent in the case of Stockholm than anywhere else in Europe.
The Swedish pretensions and the quick growth at this time can be illustrated by two quotes separated in time by half a century; one from a temporary visitor, and the other from a prominent Swedish propagandist:
...because the buildings all have flattened roofs, covered with birch-bark and verdant turfs in the same manner as the peasant's cottages in Russia. The roofs serve as pasturage, and on some goats are kept grazing, whom occasionally jumps over the street from one building to another and then back again.