Olaf II Haakonsson was king of Denmark as Olaf II (1376–1387) and king of Norway as Olaf IV (1380–1387). Olaf was son of King Haakon VI of Norway and the grandson of King Magnus IV of Sweden. His mother was Queen Margaret I of Denmark which made him the grandson of King Valdemar IV of Denmark. In addition to his claim on the thrones of Denmark and later Norway, he was in the direct succession line to the throne of Sweden (but for the interposition of Albert of Mecklenburg).
He became king of Denmark when only five years old and later also succeeded his father as king of Norway.