Edgar lived from 1074 to 8 January 1107 and was King of Scotland from 1097 to 8 January 1107. The wider picture in Scotland at the time is set out in our Historical Timeline.
In 1097 Edgar, the fourth son of Malcolm III and Margaret, came north into Scotland with an army and considerable support from William II of England and took the throne for himself, in return for becoming a vassal of the English King.
In doing so he deposed his predecessors, Donald III and Edmund, who were respectively his uncle and his brother. And in doing so he mirrored almost exactly what had been done by his half-brother Duncan II in Spring 1094. Duncan had only survived on the throne for six months, and was murdered as soon as the army he had been loaned by Willian II of England withdrew.
Edgar did not echo Duncan's mistake in leaving Donald and Edmund on the scene to challenge his rule. Donald was blinded and remained a prisoner at Rescobie, Angus until he died in about 1100. Edmund was treated less harshly than Donald by his brother, who allowed him to become a monk at Montacute Abbey in Somerset, where he lived out his days.
In 1100, Edgar's younger sister Matilda married Henry I of England and so he became the English king's brother in law. Edgar took a very submissive approach to his relations with England; and he also gave the Western Isles to the King of Norway. He was known by his subjects, very unflatteringly, as "Edgar the Peaceable".
Edgar died unmarried and childless in Edinburgh Castle on 8 January 1107. He was buried in Dunfermline Abbey and was succeeded by his younger brother, Alexander I.