In 1311 the castle passed by marriage to the estates of the House of Lancaster. Thomas, Earl of Lancaster (circa 1278–1322) was beheaded outside the castle walls six days after his defeat at the Battle of Boroughbridge, a sentence placed on him by King Edward II himself in the great hall. This resulted in the earl becoming a martyr with his tomb at Pontefract Priory becoming a shrine. It next went to Henry, Duke of Lancaster and subsequently to John of Gaunt, third son of King Edward III. He made the castle his personal residence, spending vast amounts of money improving it.