After his father's death, he found refuge in England with his kingsman Siward of Northumbria, where he stayed for more than 14 years.
His first wife was Ingibjorg, widow of Earl Thorfinn of Orkney. She died, and in about 1070 he married Margaret, great-niece of King Edward the Confessor of England. She had sought refuge in Scotland with her brother, Edgar the Atheling (Anglo-Saxon heir to the English throne), when William I excluded him from the English succession.
Margaret had a strong influence over her husband, who revered her piety and secretly had jewel-encrusted bindings made for her religious books, which he himself was unable to read, never having learned to do so. He also substituted Saxon for Gaelic as the court language.
According to Margaret's biographer, she corresponded with Lanfranc, Archbishop of Canterbury, brought Benedictine monks to Dunfermline and did away with local usages in the Scottish Church. Margaret also began building what was later to be known as St Margaret's Chapel, situated on the highest part of Edinburgh Castle.
Malcolm was determined to extend his kingdom southwards and take advantage of the upheaval caused by the Norman Conquest. Making the excuse that he was supporting the claim to the English throne of his brother-in-law Edgar Atheling, Malcolm invaded England five times (he was a formidable warrior-king, having killed his two predecessor kings).
Three times defeated, Malcolm was forced under the treaty of Abernethy in 1072 to become 'the man' of the English king and give up his son Duncan as a hostage.
Malcolm was killed in battle at Alnwick, Northumberland on 13 November 1093, aged about 62. Their eldest song, Edward, died of his wounds on 16 November, the same day that Margaret, his wife died when they brought her the news at Edinburgh Castle. She was canonised in 1249.
After Malcolm's death, the frontier between the kingdoms of Scotland and England was clearly defined for the first time. Anglo-Norman influence in Scotland was promoted by the subsequent marriages of Malcolm's sons to English brides.