Svend was made a "jarl" under Danish king Harthacnut (the two were first cousins), and led a campaign for him against Norway, but was beaten by Magnus I of Norway. When Harthacnut died in 1042, Magnus claimed the Danish throne and made Svend the "jarl" of Jutland. In 1043, Sweyn fought for Magnus at the Battle of Lyrskov Heath at Hedeby, near the present-day border of Denmark and Germany. Sweyn won a great reputation at Lyrskov Heath, and had the Danish nobles crown him king in Viborg in Jutland. He was defeated by Magnus on several occasions, and had to flee to Sweden. Eventually he managed to return and establish a foothold in Scania.