King Edgar of Scotland was the second son of Malcolm Canmore and St.Margaret, the daughter of the Saxon Edward Atheling, otherwise known as 'Edward the Exile'. He had been born around 1074 and given an Anglo-Saxon name in honour of Margaret's brother, Edgar Atheling, the Saxon candidate for the English throne. William Rufus, the King of England, had confiscated Edgar's English lands in 1091, to which his father, Malcolm III had reacted by raiding the north of England.
Known to the Scots as Etgair mac Mael Cholium, on the death of his father and elder brother Edward in 1093 at the The Battle of Alnwick and the usurpation of his uncle Donald Bane, Edgar had fled south to the relative safety of the English court. Donald appointed Edgar's older brother, Edmund, as his heir, In 1095, when Donald and Edmund were engaged in supporting a rebellion against Rufus, Edgar gained control of Lothian. With the aid of William Rufus, and accompanied by his maternal uncle and namesake Edgar the Atheling, Edgar led an army into Scotland in 1097, dethroning his uncle. He bears the distinction of being the first King of Scotland to be of mixed Gaelic and Anglo-Saxon blood.
The Annals of Tigernach record that Edgar had Donald Bane's eyes put out, which is verified by Fordun, who stated that Donald was "blinded, and doomed to eternal imprisonment ". He was then held captive at Rescobis (Rescobie), in Forfar, where he died, in 1099. Edgar's brother Edmund was banished to a monastery.
During Edgar's reign many Normans were to settle in southern Scotland. They brought Norman feudalism with them as well as the system of primogeniture which replaced the traditional Scots pattern of inheritance. Edgar abandoned Dunfermline and made Edinburgh Castle his base.
In common with all the sons of St. Margaret, Edgar was highly pious, had been brought up religiously and was a generous benefactor of the church. St. Aelred of Rievaulx spoke highly of him, even comparing him to Edward the Confessor. Edgar's religious foundations included a priory at Coldingham in 1098, associated with the Convent of Durham. At Dunfermline Abbey he sought support from Anselm of Canterbury with his mother's foundation from which the monks of Canterbury may have been expelled by Donald Bane.
The marriage of the King's sister, Edith, to Henry I, cemented peace with England. Edgar himself never married and had no issue, prior to his death, he divided his realm between his brothers. The eldest of these, Alexander, was to inherit the throne while his younger brother David was to receive Lothian and Strathclyde. In 1098, Edgar signed a treaty with Magnus Barefoot, King of Norway, setting the boundary between Scots and Norwegian claims in the west. By ceding claims to the Hebrides and Kintyre to Magnus, Edgar acknowledged the practical realities of the existing situation.
King Edgar died on 8th January, 1107, at Edinburgh Castle and was buried at Dunfermline Abbey in Fife, which was to become the mausoleum of Scotland's Kings. He was succeeded by his brother Alexander I.