Thomas Randolph , 1st Earl of Moray Thomas Randolph , 1st Earl of Moray ( died 20 July 1332 ) was Regent of Scotland , an important figure in the Wars of Scottish Independence , and is named second of those in whose names the Barons ' Letter to Pope John XXII , commonly known as the Declaration of Arbroath , was sent . Early life . He is usually described as a nephew of Robert the Bruce although their exact relationship is uncertain . The traditional view is that it was through a daughter of the first marriage of Countess Marjorie of Carrick , who was mother of King Robert by her second marriage . However modern sources state that the King ' s father Robert ( 1253 – 1304 ) married secondly , after 1292 , to a lady with the Christian name of Eleanor ( died 1331 ) by whom he had a daughter , Isabel de Bruce , who married Thomas Randolph , Lord Chamberlain of Scotland . War of Independence . Thomas , the future Earl of Moray , supported Bruce in his initial coup when he proclaimed himself king and was crowned at Scone , but was captured after the defeat at the Battle of Methven and changed sides . Later , fighting for the English , he was in the company of Bruces Scottish enemy John MacDougall of Lorn but was captured and brought before the king , whom he taunted for his alleged cowardice by engaging in guerrilla warfare instead of standing and fighting in pitched battle . He was then put into solitary confinement . However , he was persuaded to change sides again , and went on to become one of the king ' s most important lieutenants . The fact that he was allowed to resume his allegiance to Bruce suggests that they did have family ties . His most famous achievement took place on 14 March 1314 when he carried out a daring attack on Edinburgh Castle . This was one of a handful of castles in Scotland still in English hands , and stood on top of an apparently impregnable rock . Amongst his men was William Francis , the son of a former Governor , who knew about a path up the rock , which he had used to visit the town at night against his father ' s wishes . He volunteered to show Randolph the route and at the dead of night , Randolph led his men up this path to capture the castle . He played an important role in the Scottish victory at Bannockburn , where he commanded one of the divisions ( schiltrom s ) of the infantry , the others being commanded by King Robert and Edward Bruce , the king ' s brother . It is difficult to say exactly when Randolph was raised to the Earldom of Moray , but by 1315 he is style d " Thomas Ranulphi comes Morauie " . Ireland . He accompanied the king ' s brother , Edward Bruce , on his invasion of Ireland in 1315 and was one of the principal leaders of the war against the English settlers in Ireland . He was also in charge of returning to Scotland to gather reinforcements and to transfer soldiers between the two fronts as needed . Diplomatic career . After the death of Edward Bruce and the recall of the expeditionary force from Ireland , Sir Thomas was sent by his uncle as envoy to the court of Rome where he succeeded in getting a temporary absolution for King Robert who had been excommunicated for killing John Comyn . In 1326 he also led the Scottish deputation which negotiated the Treaty of Corbeil , renewing the defensive Franco - Scottish alliance . Regent . On the death of Robert I , the crown was inherited by his son David II , who was only five years old . Randolph became Regent , but three years later died of a sudden illness at Musselburgh on his way to repel an invasion by Edward Balliol and his supporters . At the time it was said that he had been poisoned by the English , but this is now discounted by many scholars though many Scots still believe he was murdered . His successor as Guardian was Domhnall II , Earl of Mar . Marriage and family . Thomas Randolph married Isabel , only daughter of Sir John Stewart of Bonkyll ( killed at the Battle of Falkirk ( 1298 ) ) , a brother of James Stewart , 5th High Steward of Scotland . They had several children , including :