Magnus was an illegitimate son of King Olaf Haraldsson (later
Saint Olaf) by his
English concubine Alfhild, originally a slave (
thrall) of Olaf's queen
Astrid Olofsdotter. Born prematurely, the child was weak and unable to breathe for the first few minutes, and he was probably not expected to survive. Olaf was not present at the child's birth, and his Icelandic
skald Sigvatr Þórðarson became his godfather. In a hasty baptism, Sigvatr named Magnus after the greatest king he knew of, also Olaf's greatest role model,
Karla Magnus, or
Charlemagne. Against the odds, Magnus went on to grow strong and healthy, and he became of vital importance to Olaf as his only son. Olaf was dethroned by the Danish king
Cnut the Great in 1028, and he went into exile with his family and court, including the young Magnus. From there they travelled southwards to
Novgorod (
Holmgard), where Olaf sought assistance from Grand Prince
Yaroslav the Wise. Yaroslav, however, did not want to become directly involved in the Scandinavian power-struggles, and declined to help. After some time, in early 1030, Olaf learned that the
Earl of Lade Håkon Eiriksson, Cnut's regent in Norway, had disappeared at sea, and gathered his men to make a swift return to Norway. Magnus was left to be fostered by Yaroslav and his wife
Ingegerd. In early 1031, a party including Magnus's uncle
Harald Sigurdsson (later also to be king and then known as Harald Hardrada) arrived to report the news of his father's death at the
Battle of Stiklestad. For the next few years, Magnus was educated in
Old Russian and some
Greek and was trained as a warrior. In 1030, Cnut appointed his first wife
Ælfgifu and their son
Svein as regents, but the Norwegians found their rule oppressive and, by the time of Cnut's death in 1035, they had been driven out and Magnus was established as king.
Einar Thambarskelfir and
Kalf Arnesson, who had both sought to be appointed regents under Cnut after Olaf's death in 1030, had gone together to Kievan Rus' to bring the boy back to rule as the
King of Norway. After receiving the approval of Ingegerd, they returned with Magnus to Sigtuna in early 1035, and received backing from the Swedish king, brother of Magnus's stepmother Astrid. Astrid immediately became an important supporter of Magnus, and an army was gathered in Sweden, headed by Einar and Kalf, to place Magnus on the Norwegian throne. ==King of Norway and Denmark==