Prior to his marriage to Margaret of Wessex, Malcolm had another wife, the Norwegian Ingibiorg Finnsdottir. Details are sketchy about this marriage, but they had at least one son, Duncan. In the initial clashes between Scotland and Duke William of Normandy, Duncan was offered as a hostage. Duncan was therefore being raised in Normandy. When William died in 1087, his son Robert Curthose released Duncan and knighted him. Duncan chose to go to England serve Robert's brother, William Rufus. Clearly, Malcolm had "written off" his eldest son by his first marriage, since he had declared his eldest by Margaret his heir.
Back in Scotland, Donald was having trouble: not everyone welcomed his return and rule. Duncan bagged negotiating with some of the landowners and local barons, making promises of land and titles. William Rufus gave him Norman military support. Within a year of Donald taking the throne, Duncan arrived at the head of an army in the summer of 1094. Donald was defeated, retreating to the Scottish Highlands.
Duncan was crowned king at Scone, but only controlled the southern part. The locals did not appreciate someone they saw as essentially an English vassal, or the presence of the Normans with him. This created discontent. He decided to send his foreign allies back to England, which created its own problems. Duncan had trouble with raids by rebels, and was forced to negotiate with them rather than defeat them.
Meanwhile, Donald was gathering his forces. After only a few months of rule, Duncan was attacked by Donald's army and killed in an ambush on 12 November.
Donald was, once again, King of Scotland, less than a year after being ousted. He chose his nephew, Malcolm's son Edmund, who had supported him after Malcolm's death, as his heir and co-ruler. This did not sit well with Edmund's siblings, as we shall see.