William kept Edgar in his custody and took him, along with other English leaders, to his court in
Normandy in 1067, before returning with them to England. Edgar might have been involved in the abortive rebellion of the Earls Edwin and Morcar in 1068, or he might have been attempting to return to
Hungary with his family and been blown off course; in any case, in that year he arrived with his mother and sisters at the court of King
Malcolm III of Scotland. Malcolm married Edgar's sister Margaret, and agreed to support Edgar in his attempt to reclaim the English throne. When the rebellion that resulted in the
Harrying of the North broke out in
Northumbria at the beginning of 1069, Edgar returned to England with other rebels who had fled to
Scotland, to become the leader, or at least the figurehead, of the revolt. However, after early successes the rebels were defeated by William at
York, and Edgar again sought refuge with Malcolm who happily allowed him asylum for his loyalty. It appears that Edgar married Malcolm's sister Margaret Canmore and the union failed to have issue. In late summer that year, the
arrival of a fleet sent by King Sweyn of Denmark triggered a fresh wave of English uprisings in various parts of the country. Edgar and the other exiles sailed to the
Humber, where they linked up with Northumbrian rebels and the Danes. Their combined forces overwhelmed the Normans at York and took control of Northumbria, but a small seaborne raid which Edgar led into the former
Kingdom of Lindsey ended in disaster, and he escaped with only a handful of followers to rejoin the main army. Late in the year, William fought his way into Northumbria and occupied York, buying off the Danes and devastating the surrounding country. Early in 1070, he moved against Edgar and other English leaders who had taken refuge with their remaining followers in a marshy region, perhaps
Holderness or the
Isle of Ely, and put them to flight. Edgar returned to Scotland. He therefore took up residence in
Flanders, whose count,
Robert the Frisian, was hostile to the Normans. However, he was able to return to Scotland in 1074. Shortly after his arrival there, he received an offer from
Philip I, King of France, who was also at odds with William, of a castle and lands near the borders of Normandy from where he would be able to raid his enemies' homeland. He embarked with his followers for
France, but a storm wrecked their ships on the English coast. Many of Edgar's men were hunted down by the Normans, though he managed to escape with the remainder to Scotland by land. Following this disaster, he was persuaded by Malcolm to make peace with William and return to England as his subject, abandoning any ambition of regaining his ancestral throne. == Italian venture ==