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.
Prehistory and origin of Stockholm
The first town in the Lake Mälaren region was undoubtedly Birka on Björkö island about 20 km west of present-day Stockholm. Founded in the late 8th century, it was described by Rimbert, Archbishop of Hamburg-Bremen, who wrote about his predecessor Ansgar's missionary journeys c. 830 and 850. For unknown reasons, Birka was deserted around 975. Shortly thereafter, Sigtuna appeared on the northern shores of Mälaren. Located on the main navigable approach to Uppsala, Sigtuna is believed to have been designed as missionary outpost and a Christian trade centre rivalling the still pagan Uppsala. While Sigtuna saw its heyday during the 10th century, the Blackfriars decided to construct their first monastery in Sweden at Sigtuna in the 1230s (inaugurated 1247), which seem to indicate Sigtuna was still the city dominating the Mälaren region at that time.
Notwithstanding surviving records makes it difficult to see exactly when and in what order events took place, several causes for the development to occur in the 13th century can be distinguished: