Llywelyn ap Gruffudd or Gruffydd (c. 1228–December 11, 1282) was the second-to-last prince of an independent Wales before its conquest by Edward I of England. In Welsh, he is remembered as Llywelyn Ein Llyw Olaf (Llywelyn, Our Last Leader).
He was one of the four sons of Gruffydd, the illegitimate son of Llywelyn the Great. Opinions vary as to whether Llywelyn was the second or third son, but he was definitely not the eldest. Having fought off the opposition of his uncles and of his eldest brother, he laid claim to the principality of Gwynedd in 1258, and took the title Prince of Wales, which was then virtually a new concept. He was recognised as such by Henry III of England in the Treaty of Montgomery in 1267. However, Llywelyn's territorial ambitions gradually made him unpopular with some of the other Welsh leaders, particularly the princes of south Wales.
Although a capable military leader, Llywelyn lacked the political acumen of his grandfather, and made an unnecessary enemy of King Edward I of England by continuing to ally himself with the family of Simon de Montfort even after a precarious peace with the English had been concluded. Edward took exception to Llywelyn's marriage contract with Simon's daughter, Eleanor, seized the ship carrying her from France to Wales, and kept her prisoner at Windsor until Llywelyn made certain concessions. They were eventually married at Worcester in 1278.
Unusually for a Welsh prince, Llywelyn had no heirs (illegitimate sons being allowed by Welsh law to inherit), and depended on Eleanor to provide him with one. In 1282, she gave birth to a daughter, Gwenllian, but died in doing so, an event which seems to have had a serious emotional impact on Llywelyn. It was at this point that his younger brother, Dafydd, launched an attack on the English. Llywelyn felt obliged to support his brother, and a war began for which the Welsh were ill-prepared. Llywelyn's capable military leadership might still have prevailed, but he was ambushed and killed at Cilmeri, near Builth Wells, while attempting to rally support in south Wales. It was not until some time later that an English knight recognised the body as that of the prince. His head was then severed and delivered to London, where it was paraded through the streets.
With the loss of Llywelyn, Welsh morale and the will to resist diminished, and Dafydd, having declared himself Llywelyn's successor, was forced to flee into the mountains. He was betrayed, captured and executed by Edward I. His wife and sons ended their lives in captivity. Llywelyn's daughter, Gwenllian, was sent to the convent of Sempringham in Lincolnshire, where she died in her fifties.