Harald Fairhair unified the Viking kingdoms of Norway in 872 AD. In the following period, Norwegians settled in many places, such as Iceland, the Faroe Islands and parts of Scotland and Ireland, where they founded Dublin. At the beginning of the 14th century, Norway and Sweden were unified. They also elected the king of Sweden as the Norwegian king. At the end of the century, the two countries and Denmark were unified in the so-called Kalmar Union.
Sweden broke out of the union in 1521. Norway remained in union with Denmark until 1814. Only a few months after the declaration of independence, The country entered into union with Sweden. However, it must be noted that this union with Sweden allowed them to keep a great deal of independence.
The union with Sweden lasted until 1905. It was the beginning of modern Norway. Germany occupied the territory from 1940 until 1945.