Like Swedish and Danish kings, Norwegian kings also had difficulties with the powerful nobles. Royal authority was restored under Haakon IV (1217-1263) who strengthened his position by the conquest of Greenland and Iceland. His successor Magnus VI (1263-1280) ended the war with Scotland and ceded the Hebrides and the Isle of Man to Alexander III of Scotland. Magnus’ reign is also notable for modernization of law-code which gave him his epithet law-mender.
The successor of Eric Magnusson (1280-1299), Haakon V Magnusson (1299-1318) tried to limit the power of nobility by appointing royal officials in administration. Haakon’s successor Magnus Eriksson (1319-1343) was elected King of Sweden in 1319 but he was opposed in Norway. He resigned as King of Norway in favor of his son Haakon VI Magnusson (1343-1380). In 1363, Haakon VI married Margaret I of Denmark. She who took over the reign in Norway after his death in 1380 and joined the realms of Denmark, Norway and Sweden into the Kalmar Union in 1397. Norway fell under Danish supremacy which lasted until 1814.