In 1204, King Haakon III died unexpectedly, and the Birkebeiner elected an infant
King Guttorm, with real power in the hands of earl
Haakon the Crazy. In response to this, the old Bagler united their army again, with the support of the King
Valdemar II of Denmark. Bishop Nikolas attempted to have his nephew, Philip, elected king. The main body of the Bagler objected to this, as Philip was not of Norwegian royal lineage. Instead,
Erling Steinvegg, a putative son of King
Magnus V of Norway was made their candidate and Philip was given the title of
earl, the highest rank below that of
king. Philip Simonson actually numbered King
Harald I of Norway, the eponymous king of the
Fairhair dynasty, among his ancestors, through his mother Margaret, whose mother descended from the Swedish
Stenkil dynasty. According to Norse legends, their ancestor
King Stenkil's mother Estrid Njalsdottir, descended from a daughter of King Harald. This descent was not fully sufficient for succession, as Norwegians had tended to require male-line descent from their royal dynasty, and claimants with even a close cognatic lineage to a recent king of Norway (such as maternal grandsons) had been exceptions and not fully approved as dynastic. Philip's Birkebeiner rival King
Inge II (successor of Guttorm Sigurdsson, chosen in 1204) had severe difficulties because he was only a maternal grandson of
King Sigurd II. In 1204, King
Valdemar II of Denmark came to Norway accompanied by the Bagler army. Erling Steinvegg was declared to be king and Philip Simonsson to be earl. This action marked the start of the second Bagler war. The Bagler rapidly gained control of the
Oslofjord-area (
Viken), while the Birkebeiner held control of the
Trøndelag-region around
Nidaros (
Trondheim). Western Norway with the city of
Bergen changed hands several times. ==Philip as king==