The prehistory of Stockholm is the continuous development and series of events that made the mouth of Lake Mälaren strategically important; a location which by the mid 13th century had become the centre of the newly consolidated Swedish kingdom.  The origin of Stockholm pre-dates its written history, and several mythological stories and modern myths have attempted to explain both its emergence and its name.
 Stockholm stands on a bedrock of gneiss and granite approximately 2 billion years old.  Over millions of years, north-west to south-east oriented cracks appeared in the rock, which rivers transformed into the valleys still present in the landscape, for example the lakes Långsjön, Magelungen, and Drevviken.  All around Stockholm, such open fields are separated by forest-laden ridges.  Late in this geological process, east to west-oriented faults appeared, resulting in for example the tall, dark cliffs along the northern waterfront of Södermalm.
 Three million years ago, a series of ice ages started to grind down the north-bound faults, leaving the south-bound formations intact.  During the latest ice age (70,000-9,500 BCE), the area surrounding Stockholm was covered by an ice layer up to two kilometres thick.  While the ice effectively eliminated every trace of pre-ice age life, it is assumed humans probably did inhabit the area before the ice age, notwithstanding no archaeological traces can confirm it.  Nevertheless, bones from a mammoth have been found in the Brunkebergsåsen esker stretching north to south through central Stockholm.
 As ice lightened its grip of the area about 11,500 BCE, the area was inundated by melt water before the land started to rise and the first islets rose over the water surface (at the time located about 40 metres over the present sea level).  The retiring ice left behind a cover of sand, gravel, and rocks forming moraine ridges still witnessing how the ice gave up some 250 m annually over two centuries.  Under the ice sheet, streams formed eskers, most notably the huge Brunkebergsåsen, the steep slopes of which still form barriers in central Stockholm.
 After some 1000 years the first humans settled in the area to start the Stone Age era characterized by a climate similar to that of the present Mediterranean Sea.  Due to land elevation, the archaeological traces of these first coastal settlements are today found far from the coast and the modern metropolitan area.  The traces consists of various tools, including quartz and flint arrowheads used by these hunter-gatherers to catch mostly seals.  During the end of the Stone Age (4200–1800 BCE) humans started to use more stationary settlements, solid buildings standing on strong poles drilled into the ground, even if the access to food still made migratory periods necessary.  Graves got more elaborate as grinned axes made of carefully selected and often imported rocks accompanied the dead together with ceramics, fancy garments, and other impressive objects.
 The first town in the Lake Mälaren region was undoubtedly Birka on Björkö island about 30 km west of present-day Stockholm.[citation needed]  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:
 Of the half dozen trade posts in Sweden described in 1120 as cathedral cities or cities with a potential to become such, Sigtuna is believed to be the only one with the density and status of a city in the proper sense.  This quickly changed as German merchants introduced developed forms of production and 'industrialised' Swedish mining, mostly during the second half of the 13th century.  This rewrote the regional map and resulted in the gradual development of a Swedish urbanity. As trade routes moved westward in the Mälaren region, Sigtuna found itself left astern.
 Birger jarl's elimination of the "true Folkungs" between 1247 (Battle of Sparrsätra) and 1251 (Battle of Herrevadsbro) lead to increased consolidation of the Swedish kingdom and the introduction of a continental feudal society.  Additionally, the Swedish dominion expanded east as Birger jarl and Torgils Knutsson conquered Tavastland and Karelia (later Finland) which placed present-day Stockholm, until then an insignificant peripheral island, in the absolute centre of the small empire.
 Lastly, navigation on Lake Mälaren changed dramatically as land elevation isolated it from the Baltic Sea during the 13th century and made the strait in what is today central Stockholm the only navigable passage into the Lake Mälaren region.  It remains uncertain when this happened more precisely, but the development was further accelerated by the growth of international trade in the Baltic.  The streams around Stadsholmen can't have been much of a problem for Viking longships or traditional knarrs, but as German merchants introduced the sea-going deep-draught cogs, the straits and streams at the mouth of Lake Mälaren became insurmountable obstacles which thus created a need for a trading post at the location.
 While the oldest traces of human activities in present Stockholm are considerably older, the development as described above preceded the foundation of the city on its present location.  However, Birka, Sigtuna, and Stockholm forms a series of urban structures which can be thought of as the capital of the Lake Mälaren region, at a few occasions relocated to fit into the socio-economic structure of the day.
 The watercourse passing south of the old town of Stockholm first appears in historical records as the somewhat cryptic phrase: "What split off is called Stockholm" (Stockholm heter det som sprack av), found in a version of the Saga of the Saint Olaf by the Icelandic author Stymer Frode, preserved through a manuscript from the 14th century.  Stymer explains, what today are the islands  Södermalm and Stadsholmen was at the time united by an isthmus, and Saint Olaf of Norway (995-1030) produced the strait, in the saga called Konungssund ("King's strait"), by summoning assistance from superior forces.  A slightly different version, undoubtedly the most famous, is the account of the Icelandic historian Snorri Sturluson (1178–1241).  He retells, while King Olav of Norway raided the Lake Mälaren area, the Swedish king Olof Skötkonung (960s-1021/1022) hoped to trap him by pulling an iron chain over Stocksund ("Log Strait", e.g. modern Norrström passing north of the old town), a strait in addition guarded by a castellum and an army on either sides.  The Norwegian king then dug himself through the southern isthmus and, helped by vivid streams produced by spring flood and favourable winds, managed to have his ships break through the foreshore and shoals, and finally escaped to the Baltic Sea.  Snorri however adds, the Swedes refuted this version as drivel.
 Stockholm derives its mythological origin from a dwelling place called Agnefit. The second element fit means 'moist meadow' and, arguably, the only possible location for a meadow in present-day Stockholm at the time was on the western shore of today's Stadsholmen.  The first element of this name is, explains the historian Snorri Sturluson (1178–1241), derived from King Agne, a presumably mythological king who in a dim and distant past (around 400 A.D. according to some historians) encamped here after having successfully raided Finland.  His intentions were to marry Skjalf, the daughter of the defeated Finnish tribal chief.  The young woman, however, tricked him to arrange a celebration including prominent guests which eventually turned into a boozing party, and, while Agne slept sober, Skjalf had him hung in his gold necklace before escaping.
 A modern story dated back to the mid 17th century, tells how the population of Birka, a historical city on Lake Mälaren, grew too rapidly, and the Gods then consulted urged parts of the population to emigrate to a new site. To determine where to build the new city, it was decided a log bound with gold should point out where to settle by sailing ashore on the site, and, occasionally, it landed on an islet in what is today central Stockholm.  According to a 17th-century myth, the tower Birger Jarls torn, often and erroneously said to be the oldest building in Stockholm, was built on this location.
 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.
 While the reliability of these stories remains disputed, dendrochronological examinations of logs driven into the seabed in Norrström, square oak logs, and sunken logs found on Helgeandsholmen just north of Stadsholmen in 1978-1980, concluded these trees were cut down during the period 970-1020, most of them from around 1010, and these logs presumably gave the entire city its present name, Stock-holm, "Log-Islet".
 Anyhow, any hypothesis on the origin of the city necessarily need to depart from three poorly documented defensive structures:
 It is often said the keep of the Three Crown Castle originated from at least parts of these defensive structures.  As historical and archaeological records are fragmentary, the origin of this tower and the castle remain open for various interpretations, as do the size and extent of the city at the time.  Some researchers conclude Stockholm evolved into the Swedish capital and an important trade city before 1200 (Kumlien), while others suggest the location remained a mostly rural area around 1250 to quickly expand into the large city before the castle was completed (Hansson, Ödman).
 The first, verified, mention of the name 'Stockholm' is from two letters written in Latin in 1252; the first, written in July, is a letter where the King Valdemar and Birger Jarl offered their royal patronage to Fogdö Abbey; and the other, written by Birger Jarl in August, urged the peasantry in Attundaland to pay their tithes to the Uppsala Cathedral.  Both letters were written in Stockholm, but give no further information of the city itself or any explanation on the background of the name.  However, it can be assumed at least some sort of dwelling in consistence with the station of a Swedish jarl existed at that time.
 While the name itself easily splits into two distinct elements - stokker, or in modern Swedish stock, meaning "log", and holme, meaning "islet" - a matter-of-fact explanation for the name is much harder to produce, and over the years many popular myths have, accordingly, attempted to give a background. The first attempt to a more serious explanation was put forward by the German humanist Jacob Ziegler in his work Schondia (Scandinavia) printed in 1532. Writing in Latin, he describes the city as the stronghold and trade post of the Swedes, located among paludibus, meaning either marshes or lakes, and - like Venice - resting on poles. Most likely, while in Rome Ziegler must have come in contact with prominent Swedes like Johannes Magnus who supplied him with the description of the city, which still today styles itself "The Venice of the Nordic countries" (Nordens Venedig).
 Other interpretations includes stock being an allusion to:
 To add to the enigma, Stockholm has been called Eken ("The oak") in many contexts. While it is mostly associated with slang today, it is supposedly derived from Stockhäcken, the name the city was given by traders from Västergötland (called Västgötaknallar).