 In 1376 Olaf inherited the crown of Denmark from his maternal grandfather as King Olaf II, with his mother as guardian; when Haakon VI died in 1380, Olaf also inherited the crown of Norway.Margaret became regent of Denmark and Norway when Olaf died in 1387, leaving her without an heir.She adopted her great-nephew Eric of Pomerania the same year.