Edgar was born in 1074, the fourth son of Malcolm III and Margaret. He tried to claim the throne of Scotland in 1095 but there was a succession dispute with his uncle and brother also claiming power. Edgar was only able to take the throne in 1097 with the support of the English King William II. Edgar also held considerable lands in England and was a loyal vassal of King William.

Rather than risk another challenge from his uncle and brother Edgar dealt with them decisively, blinding and imprisoning his uncle and sending his brother Edmund to become a monk at an abbey in Somerset.

In 1098 Edgar signed a treaty with the Norwegian King Magnus which relinquished the Scottish claim to the Western Isles, including the then traditional burial place of kings, Iona. He also remained indebted to the English who had supported him in taking the throne and in 1100 Edgar's sister Matilda married the new English King Henry I.

Edgar himself never married and produced no heir. He died in 1107 and was buried in Dunfermline Abbey. His younger brother Alexander succeeded him but he also left the south of the kingdom to his other brother David who was to succeed Alexander.