William Douglas lived from 1425 to 22 February 1452. He was the 8th Earl of Douglas and the 2nd Earl of Avondale. The wider picture in Scotland at the time is set out in our Historical Timeline.
The Douglas family had a very close relationship with the ruling House of Stewart from the 1300s. Too close on occasion, for the power gathered by the family meant that they were at times viewed as a threat by the monarch of the day. The Black Douglases, as the main branch of the family was known, also made other enemies within the kingdom. During the minority of James II, the 5th Earl of Douglas and his younger brother had been murdered during the "Black Dinner" at Edinburgh Castle in the presence of James II (and despite his protests) on trumped-up charges of treason intended to promote the interests of other powerful families within the kingdom.
Amongst those who benefitted from the murder of the young Douglases was their uncle, James Douglas ("the Gross"), who inherited the title as 7th Earl of Douglas, but without most of the property and power that previously went with it. His death on 24 March 1443 made his son William Douglas the 8th Earl of Douglas. William recovered control over much of the Black Douglas property across south-west Scotland by marrying (with papal dispensation) his cousin, and the daughter of the 5th Earl of Douglas, the Fair Maid of Galloway.
William started out by maintaining very good relations with James II, which allowed him to partly avenge the murder of the 5th Earl. But by 1450 it seems that Stewart concerns about the growing power of the Douglases were rearing their head once more. The situation was not helped when it came to James II's attention that William Douglas was plotting against him with another powerful lowland lord, Alexander Lindsay, 4th Earl of Crawford, and with John, Lord of the Isles.
James II invited William Douglas to meet him at Stirling Castle under a safe-conduct on 22 February 1452. The king probably intended to try to reason with someone who had been an ally in the past to become one again. But whatever his intentions, it seems there was no agreement and James II lost his temper, stabbing William Douglas with a dagger. The 8th Earl of Douglas was then finished off by courtiers, his murder remembered by the naming of the Douglas Room in Stirling Castle. James II went on to make a determined effort to wipe the Black Douglases off the face of Scotland.