According to Snorre Sturlasson, Oslo was founded by King Harald Hårdråde at the mid-11th century. Olaf Kyrre III made Oslo an Episcopal seat at the end of the 11th century. Around 1300, the Norwegian royalty increased its power. King Haakon Magnusson had Akershus Castle built and also made it his permanent royal residence.
Merchants from Rostock came to Oslo around 1300 and soon controlled the town ´s export. The merchants from north Germany controlled the trade for about 200 years. During the 16th century, the power of the Hanseatic League declined in the northern waters. Trade in Oslo flourished. The most important goods of export were forest products such as timber and tar. One imported salt and luxury items.
In 1624, the town below Akershus was burnt down because a maid had been careless with fire. After the fire, Christian IV decided that a new town, Christiania, would be built at a distance from the castle. This town was to be constructed according to the chequered pattern of the Renaissance and the Baroque. It was also fortified.
In 1814 Christiania became the capital of Norway, which was then united with Sweden. The Union was dissolved in 1905 and 20 years later Christiania took back its medieval name Oslo.