David II was the elder and only surviving son of Robert I of Scotland and his second wife, Elizabeth de Burgh. He was born on 5 March 1324 at Dunfermline Abbey, Fife. His mother died in 1327. In accordance with the Treaty of Northampton's terms, David was married on 17 July 1328 to Joan of the Tower, daughter of Edward II of England and Isabella of France, at Berwick-upon-Tweed. They had no issue.
David became King of Scots upon the death of his father on 7 June 1329, aged 5 years, 3 months, and 3 days. David and his wife were crowned at Scone on 24 November 1331.
During David's minority, Sir Thomas Randolph, 1st Earl of Moray was appointed Guardian of Scotland by the Act of Settlement of 1318. After Moray's death, on 20 July 1332, he was replaced by Donald, Earl of Mar, elected by an assembly of the magnates of Scotland at Perth, 2 August 1332. Only ten days later Mar fell at the Battle of Dupplin Moor. Sir Andrew Murray of Bothwell, who was married to Christian (or Christina), the sister of King Robert I, was chosen as the new Guardian. He was taken prisoner by the English at Roxburgh in April 1333 and was thence replaced as Guardian by Archibald Douglas (the Tyneman), who fell at Halidon Hill that July.
Meanwhile, on 24 September 1332, following the Scots' defeat at Dupplin, Edward Balliol, a protégé of Edward III of England, and a pretender to the throne of Scotland, was crowned by the English and his Scots adherents. By December, however, Balliol was forced to flee to England; he returned the following year as part of an invasion force led by the English king.
Following the victory of this force at the Battle of Halidon Hill in July 1333, David and his wife were sent for safety into France, reaching Boulogne on 14 May 1334. They were received very graciously by King Philip VI. Little is known about the life of the Scottish king in France, except that Château Gaillard was given to him for a residence, and that he was present at the bloodless meeting of the English and French armies in October 1339 at Vironfosse, now known as Buironfosse, in the Arrondissement of Vervins.
Meanwhile, David's representatives had once again obtained the upper hand in Scotland, and the king was able to return to his kingdom, landing at Inverbervie in Kincardineshire on 2 June 1341, when he took the reins of government into his own hands.
In 1346, under the terms of the Auld Alliance, David invaded England in the interests of the French, who were at war with the English in Normandy. After initial success at Hexham, David was wounded, and his army soundly defeated at the Battle of Neville's Cross on 17 October 1346. David was captured and taken prisoner by Sir John de Coupland, who imprisoned him in the Tower of London. David was transferred to Windsor Castle in Berkshire upon the return of Edward III from France. The depiction of David being presented to King Edward III in the play The Reign of King Edward the Third is fictitious. David and his household were later moved to Odiham Castle in Hampshire. His imprisonment was not reputed a rigorous one, although he remained in England for eleven years.
On 3 October 1357, after several protracted negotiations with the Scots' regency council, a treaty was signed at Berwick-upon-Tweed under which Scotland's nobility agreed to pay 100,000 marks (to be paid at the rate of 10,000 marks per year) as a ransom for their king. This was ratified by the Scottish Parliament at Scone on 6 November 1357.
David returned at once to Scotland; but, after a few years, owing to the poverty of the kingdom, it was found impossible to raise the ransom installment of 1363. David then made for London and sought to get rid of the liability by offering to bequeath Scotland to Edward III or one of his sons in return for a cancellation of the ransom. David did this with the full awareness that the Scots would never accept such an arrangement. In 1364, the Scottish parliament indignantly rejected a proposal to make Lionel, Duke of Clarence, the next king; but over the next few years, David strung out secret negotiations with Edward III, which apparently appeased the matter.
He remarried about 20 February 1364, Margaret Drummond, widow of Sir John Logie, and daughter of Sir Malcolm Drummond. He divorced her about 20 March 1370. They had no issue. Margaret, however, travelled to Avignon and made a successful appeal to the Pope to reverse the sentence of divorce which had been pronounced against her in Scotland. She was still alive in January 1375.
From 1364, David governed with vigour, dealing firmly with recalcitrant nobles and wider baronial revolt, and continued to pursue the goal of final peace with England. By the time of his death, the Scottish monarchy was stronger, and the kingdom and royal finances more prosperous than might have seemed possible.
David II died unexpectedly and at the height of his power in Edinburgh Castle on 22 February 1371. He was buried in Holyrood Abbey. At the time of his death, he was planning to marry his mistress, Agnes Dunbar (niece of Agnes Randolph, also known as "Black Agnes of Dunbar"). He left no children and was succeeded by his nephew, Robert II, the son of David's half-sister Marjorie Bruce. He was the last male of the House of Bruce.
David II has been depicted in historical novels. They include Cressy and Poictiers; or, the Story of the Black Prince's Page (1865) by John George Edgar (1834–1864). The novel depicts events of the years 1344 to 1370, with an epilogue in 1376. The events depicted cover part of the Hundred Years' War and the "Scotch Border Wars" (Second War of Scottish Independence). With the Battle of Neville's Cross (1346) being a key part of the plot. David II is one of the "principal characters", alongside Edward III of England, Philippa of Hainault, and Edward, the Black Prince.
Flowers of Chivalry (1988) by Nigel Tranter. Covers events of the Second War of Scottish Independence from 1332 to 1339. David II is a secondary character, the protagonists being Alexander Ramsay of Dalhousie and William Douglas, Lord of Liddesdale.
Vagabond (2002) by Bernard Cornwell.
David II also appears as a character the Elizabethan play Edward III.