Thomas Dunbar, 5th Earl of Moray inherited the title before 15 February 1392. In 1388 he displaced Alexander Stewart, Earl of Buchan as the provider of protection to Alexander Bur, Bishop of Moray and his church lands—following Buchan's burning of Elgin Cathedral in 1390 this agreement was dissolved. He replaced Buchan as sheriff of Inverness in 1390. In 1394, Moray was pressured into paying protection money to Alexander, lord of Lochaber and into granting him lands. Moray was an adherent of Robert Stewart, Duke of Albany and was appointed to the special council that was set up to supervise Robert III's son, David Stewart, Duke of Rothesay, when he was appointed lieutenant of Scotland in 1399. On 14 September 1402, a Scots army has defeated at the battle of Homildon Hill where Moray was taken prisoner—he did not receive his freedom until July 1405. He died before August 1422 and was succeeded by his son Thomas before 9 August 1422.