The history of Norway has been influenced to an extraordinary degree by the terrain and the climate of the region. About 10,000 BC, following the retreat of the great inland ice sheets, the earliest inhabitants migrated north into the territory which is now Norway. They traveled steadily northwards along the coastal areas, warmed by the Gulf Stream, where life was more bearable. In order to survive they fished and hunted reindeer (and other prey). Between 5,000 BC and 4,000 BC the earliest agricultural settlements appeared around the Oslofjord. Gradually, between 1500 BC and 500 BC, these agricultural settlements spread into the southern areas of Norway - whilst the inhabitants of the northern regions continued to hunt and fish.
The Neolithic period started 4000 BC. The Migration Period caused the first chieftains to take control and the first defenses to be made. From the last decades of the 8th century Norwegians started expanding across the seas to the British Isles and later Iceland and Greenland. The Viking Age also saw the unification of the country. Christianization took place during the 11th century and Nidaros became an archdiocese. The population expanded quickly until 1349 (Oslo: 3,000; Bergen: 7,000; Trondheim: 4,000) when it was halved by the Black Death and successive . Bergen became the main trading port, controlled by the Hanseatic League. Norway entered the Kalmar Union with Denmark and Sweden in 1397.
After Sweden left the union in 1523, Norway became the junior partner in Denmark–Norway. The Reformation was introduced in 1537 and absolute monarchy imposed in 1661. In 1814, Norway was ceded to the king of Sweden by the Treaty of Kiel. Norway declared its independence and adopted a constitution. However, no foreign powers recognized the Norwegian independence but supported the Swedish demand for Norway to comply with the treaty of Kiel. After a short war with Sweden, the countries concluded the Convention of Moss, in which Norway accepted a personal union with Sweden, keeping its Constitution, Storting and separate institutions, except for the foreign service. The union was formally established after the extraordinary Storting adopted the necessary amendments to the Constitution and elected Charles XIII of Sweden as king of Norway on 4 November 1814.