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.
History of Stockholm
Around 1560–80, most of the citizens, some 8.000 people, still lived on Stadsholmen. This central island was at this time densely settled and the city was now expanding on the ridges surrounding the city. Stockholm had no private palaces at this time and the only larger buildings were the castle, the church, and the former Greyfriars monastery on Riddarholmen. The surrounding ridges, unable to boast a single timber framed building, were mostly used for activities that either required a lot of space, produced odours, or could cause fire. Even though some burghers had secondary residences outside the city, the population living on the ridges, perhaps a quarter of the city's population, were mostly poor, including the royal personnel occupying the ridges north of the city.