Malcolm, son of Kenneth II, took advantage of the fact that the English were preoccupied with Danish raids and marched south, winning the Battle of Carham against the Angles in 1018 and thereby regaining Lothian.
Thirteen years later, however, King Canute invaded Scotland, probably because Malcolm had been making alliances with the Danes, and forced the Scottish king to submit to him (submission was a traditional expression of personal homage). However, Canute seems to have recognised Malcolm's possession of Lothian.
In the west, Malcolm had the alliance of Strathclyde, whilst the marriage of his daughter to Sigurd the Stout, Norse Earl of Orkney, extended Malcolm's influence to the far north. Malcolm died at Glamis, Angus on 25 November 1034, aged at least 80.
After Malcolm II's reign, Scottish succession was based on the principle of direct descent. Previously, succession was determined by tanistry - during a king's lifetime an heir was chosen and known as tanaiste rig, or 'second to the king'.