He was a prince of Gwynedd, a younger son of Gruffydd ap Llywelyn and his wife, Senena, and thus grandson of Llywelyn the Great. During his career, Dafydd had repeatedly switched allegiances between his elder brother Llywelyn and King Edward I of England, but it was his rash attack on Hawarden Castle in March, 1282, that caused the final conflict with Norman England, in the course of which Welsh independence was lost. The last Prince of Gwynedd and Wales, he ruled only for a few months after Llywelyn's death, effectively an outlaw. Seeking refuge from the English forces in the mountains of Gwynedd, he was eventually captured and executed at Shrewsbury, and is identified by some sources as the first victim of the punishment for a new crime—High Treason. He died via disembowellment, having his intestines seared with a hot iron, hanging, and drawing and quartering. His two sons and several daughters, mostly by Elizabeth (or Eleanor) Ferrars, were sent to prison and convents respectively after his death, and none ever emerged alive to threaten English domination.
David or Dafydd ap Llywelyn (1208 - 1246) was the only legitimate son of Llywelyn the Great by his wife, Joan (daughter of King John).
Recognised as Prince of Wales by his uncle King Henry III of England in 1220 (the first to hold this title officially), he ruled Gwynedd following his father's death in 1240, despite the rival claims of his half-brother, Gruffyddap Llywelyn.
Dafydd's revolt of 1244 against the Crown was only a temporary success, and his sudden death led to disorder, his marriage to Isabella de Breos having failed to produce an heir.