See also Gruffydd ap Llywelyn Fawr
Gruffydd ap Llywelyn (c. 1007 - August 5, 1063), was the ruler of all Wales from 1055 until his death, one of very few able to make this boast. He was great-great-grandson to Hywel Dda and King Anarawd ap Rhodri of Gwynedd.
Gruffydd was the eldest of two sons of Llywelyn ap Seisyll, who had been able to rule both Gwynedd and Powys. On Llywelyn's death in 1023, a member of the Aberffraw dynasty, Iago ab Idwal ap Meurig, became ruler of Gwynedd. Gruffydd according to an early story had been a lazy youth, but one New Year's Eve, he was driven out of the house by his exasperated sister. Leaning against the wall of another house, he heard a cook who was boiling pieces of beef in a cauldron complain that there was one piece of meat which kept coming to the top of the cauldron, however often it was thrust down. Gruffydd took the comment to apply to himself, and began his rise to power.
In 1039 Iago ab Idwal was killed by his own men (his son Cynan ap Iago, who may have been as young as four, was taken into exile in Dublin) and Gruffydd, already the usurper-king of Powys, was able to become king of Gwynedd. Soon after gaining power he surprised a Mercian army at Rhyd y Groes near Welshpool and totally defeated it, killing its leader, Edwin, the brother of Leofric, Earl of Mercia. He then attacked the neighbouring principality of Deheubarth which was now ruled by Hywel ab Edwin. Gruffydd defeated Hywel in a battle at Pencader in 1041 and carried off Hywel's wife. Gruffydd seems to have been able to drive Hywel out of Deheubarth in about 1043, for in 1044 Hywel is recorded as returning with a Danish fleet to the mouth of the River Tywi to try to reclaim his kingdom. Gruffydd however defeated and killed him in a close fought fight.
Gruffydd ap Rhydderch of Gwent was able to expel Gruffydd ap Llywelyn from Deheubarth in 1047 and became king of Deheubarth himself after the nobles of Ystrad Tywi had attacked and killed 140 of Gruffydd ap Llywelyn's household guard. He was able to resist several attacks by Gruffydd ap Llywelyn in the following years. Gruffydd ap Llywelyn was active on the Welsh border in 1052, when he attacked Herefordshire and defeated a mixed force of Normans and English near Leominster.
In 1055 Gruffydd ap Llywelyn killed his rival Gruffydd ap Rhydderch in battle and recaptured Deheubarth. Gruffydd now allied himself with Ælfgār, son of Earl Leofric of Mercia, who had been deprived of his earldom of East Anglia by Harold Godwinson and his brothers. They marched on Hereford and were opposed by a force led by the Earl of Hereford, Ralph the Timid. This force was mounted and armed in the Norman fashion, but on October 24 Gruffydd defeated it. He then sacked the city and destroyed its Norman castle. Earl Harold was given the task of counter attacking, and seems to have built a fortification at Longtown in Herefordshire before refortifying Hereford. Shortly afterwards Ælfgār was restored to his earldom and a peace treaty concluded.
Around this time Gruffydd was also able to seize Morgannwg and Gwent, along with extensive territories along the border with England. In 1056, he won another victory over an English army near Glasbury. Now a true King of Wales, he claimed sovereignty over the whole of Wales - a claim which was recognised by the English. Historian John Davies states that Gruffydd was "the only Welsh king ever to rule over the entire territory of Wales... Thus, from about 1057 until his death in 1063, the whole of Wales recognised the kingship of Gruffudd ap Llywelyn. For about seven brief years, Wales was one, under one ruler, a feat with neither precedent nor successor."
Gruffydd reached an agreement with Edward the Confessor, but the death of his ally Ælfgār in 1062 left him more vulnerable. In late 1062 Harold Godwinson obtained the king's approval for a surprise attack on Gruffydd's court at Rhuddlan. Gruffydd was nearly captured, but was warned in time to escape out to sea in one of his ships, though his other ships were destroyed. In the spring of 1063 Harold's brother Tostig led an army into north Wales while Harold led the fleet first to south Wales and then north to meet with his brother's army. Gruffydd was forced to take refuge in Snowdonia, but at this stage his own men killed him, on 5 August according to Brut y Tywysogion. The Ulster Chronicle states that he was killed by Cynan ap Iago in 1064, whose father Iago ab Idwal had been put to death by Gruffydd in 1039.  Gruffydd had probably made enemies in the course of uniting Wales under his rule. According to Walter Map, Gruffydd said of this:
Speak not of killing; I but blunt the horns of the offspring of Wales lest they should injure their dam.
Gruffydd's head and the figurehead of his ship were sent to Harold.
Following Gruffydd's death, Harold married his widow Ealdgyth, though she was to be widowed again three years later. Gruffydd's realm was divided again into the traditional kingdoms. Bleddyn ap Cynfyn and his brother Rhiwallon came to an agreement with Harold and were given the rule of Gwynedd and Powys. Thus when Harold was defeated and killed at the Battle of Hastings in 1066, the Normans reaching the borders of Wales were confronted by the traditional kingdoms rather than a single king. Gruffydd left two sons who in 1069 challenged Bleddyn and Rhiwallon at the battle of Mechain in an attempt to win back part of their father's kingdom. However they were defeated, one being killed and the other dying of exposure after the battle.
. John Davies (historian). A History of Wales. Penguin. 1993. London. 100. 0-14-01-4581-8.