Andrew Murray was the posthumous son of the freedom fighter Andrew Moray, who fought beside the Scots patriot William Wallace and died of wounds sustained at the Scottish victory of the Battle of Stirling Bridge shortly before his son's birth.
Murray inherited his father's lordship of Petty and his uncle, Sir William Murray's lordship of Bothwell in Lanarkshire. In July 1326 he married Christina Bruce, the widowed sister of King Robert I. His two sons, Sir John Murray (d.1351) and Sir Thomas Murray (d.1361) are thought to have been the issue of a previous marriage.
Following the death of Robert the Bruce and the accession to the Scottish throne of his five year old son David Bruce, Edward Balliol, the eldest son and heir of John Balliol, who had long held hopes of attaining the Scottish throne, landed on the coast of Fife and proceeded toward Perth. He defeated nobles loyal to the memory of Robert the Bruce in a bloody battle at Dupplin Moor near Perth and was duly crowned Edward, King of Scots at Scone Abbey. In 1332, at a meeting in Dumbarton Castle, Murray was elected Guardian of Scotland by Scots who adhered to Robert the Bruce's young son, David II. The young king was sent to France for his greater safety, where he was received by King Phillip VI.
Murray marched south to put down an uprising in Galloway, which openly supported Balliol, who was based at Perth. At dawn on 17 December 1332, he attacked Balliol at Annan, forcing Balliol and his supporters to flee to Carlisle, with Balliol, it is reported, wearing only his underclothes. King Edward III of England, having been promised the whole of Lothian, including Edinburgh by Balliol in return for his aid, marched north and laid siege to the border town of Berwick.
The Scots attempted to draw Edward III away from Berwick by raiding northern England. Murray, while attempting to rescue Ralph Golding, was captured by the English and taken to Durham in April 1333. The replacement Guardian of Scotland, Sir Archibald Douglas, brother of Robert the Bruce's companion, James, the Black Douglas, attempted to relieve Berwick and met Edward III in battle at Haildon Hill on 19 July 1333, which resulted in a decisive English victory and the death of Douglas.
On payment of a ransom, Murray was released in 1334 and returned to Scotland. Along with Alexander de Mowbray, he marched into Buchan with an armed force and besieged Balliol's ally, Henry de Beaumont in his castle of Dundarg, on the Moray Firth. When the castle fell he allowed de Beaumont to return to England. Murray was appointed Guardian of Scotland for the second time, after a meeting of nobles loyal to the young David II at Dumbarton Castle.
In 1335, he went into hiding with the Earl of March and William Douglas, Lord of Liddesdale. When the Earl of Athole, a leading supporter of Balliol, laid siege to the castle of Kildrummie in the valley of the River Don in Aberdeenshire, in which Murray's wife and children were lodged, the three emerged from their hiding place and marched against Kildrummie. Kildrummie Castle had been held for some time for King David by his aunt, Murray's wife, Christina Bruce. Murray surprised and slew Athole in the forest of Kilblain or Culbleen.
King Edward III led an army into Scotland, and attempted in vain to bring Murray to battle. Thoughout the winter of 1335-6, Murray retained an army in the field, and besieged the castles of Cupar-Fife and Lochindorb in Cromdale, but retired from Lochindorb on the approach of Edward. King Edward returned to England upon which Murray assumed the offensive, taking the castles of Dunnottar, Lauriston, and Kinclevin, and laid waste the lands of Kincardine and Angus.
Early in 1337, with the support of the Earls of March and Fife and William Douglas, he marched through Fife, destroyed the tower of Falkland, took the castle of Leuchars, and, after three weeks' siege, captured and sacked St Andrews Castle. Cupar, however, still held out under the command of William Bullock.
In March, Murray's Castle of Bothwell in south Lanarkshire was recaptured, making the way to England clear. Murray led his troops as far south as Carlisle, before wheeling around on Edinburgh. The English Marchers hastened to relieve the city, their forces clashed at Crichton. Douglas was wounded in the ensuing combat, and Murray, although he claimed victory, raised the siege.
Murray retired in 1338 to Avoch Castle in Ross where he later died. He was buried in the chapel of Rosemarkie, but his remains were afterwards removed to Dunfermline Abbey and interred near to those of Robert the Bruce.