The history of Gwynedd in the High Middle Ages is a period in the history of Wales spanning the 11th to the 13th centuries. Gwynedd, located in the north of Wales, eventually became the most dominant of Welsh polities during this period. Contact with continental courts allowed for Gwynedd to transition from a petty kingdom into an increasingly sophisticated principality of seasoned courtiers capable of high-level diplomacy and representation, not only with the Angevin kings of England, but with the king of France and the Papacy. Distinctive achievements in Gwynedd include the further development of medieval Welsh literature, particularly the work of the princely court poets known as ('Poets of the Princes') and the reformation of bardic schools; and the continued development of ('The Law of Hywel'; that is, medieval Welsh law). All three of these further contributed to the development of a Welsh national identity in the face of Anglo-Norman encroachment on Wales.

Gwynedd's traditional territory included Anglesey () and all of north Wales between the River Dyfi in the south and River Dee () in the northeast.Davies, John, A History of Wales, Penguin, 1994, foundations of pgs 50–51, 54–55 The Irish Sea () lies to the north and west, and lands formerly part of the Kingdom of Powys border the south-east. Gwynedd's strength was due in part to the region's mountainous geography which made it difficult for foreign invaders to campaign in the country and impose their will effectively.Lloyd, J. E., A History of Wales; From the Norman Invasion to the Edwardian Conquest, Barnes & Noble Publishing, Inc. 2004, Recovers Gwynedd, Norman invasion, Battle of Anglesey Sound, pgs 21–22, 36, 39, 40, later years 76–77

Gwynedd emerged from the Early Middle Ages having suffered from increasing Viking raids and various occupations by rival Welsh princes, causing political and social upheaval. With the historic Aberffraw family displaced, by the mid-11th century Gwynedd was united with the rest of Wales by the conquest of Gruffydd ap Llywelyn, followed by the Norman invasions between 1067 and 1100.

After the restoration of the Aberffraw family in Gwynedd, a series of successful rulers such as Gruffudd ap Cynan, Owain Gwynedd, Llywelyn ab Iorwerth and his grandson Llywelyn ap Gruffudd led to the emergence of the Principality of Wales, based in Gwynedd.Lloyd, J. E., A History of Wales; From the Norman Invasion to the Edwardian Conquest, Barnes & Noble Publishing, Inc. 2004, "[Llywelyn's territory had become] a virtual principality of Wales", page 222. The emergence of the principality in the 13th century was proof that all the elements necessary for the growth of Welsh statehood independent of England were in place.Davies, John, A History of Wales, Penguin, 1994, emerging defacto statehood pg 148. As part of the Principality of Wales, Gwynedd would retain Welsh laws and customs and home rule until the Edwardian conquest of Wales of 1282.

History

11th century

Norse raids; Aberffraw dispossessed

The latter part of the 10th century, and the whole of the 11th century, was an exceptionally tumultuous period for the Gwyneddwyr, Gwynedd's Welsh populace.Davies, John, A History of Wales, Tumultuous century, Meredudd ab Owain, Viking raids of, Anglesey name origin pg 98, 99; Deheubarth's ruler Maredudd ab Owain deposed Gwynedd's ruler Cadwallon ab Ieuaf of the House of Aberffraw in 986, annexing Gwynedd to his enlarged domain, which came to include most of Wales.

The Hiberno-Norse from Dublin and the Isle of Man routinely raided the coasts of Wales, with the Welsh people of Ynys Môn and the Llŷn Peninsula suffering the most in Gwynedd. In 987 a Norse raiding party landed on Môn and captured as many as two thousand of the island's residents, selling them as slaves across northern Europe. The historian John Davies argues that it is during this period that the Norse name for Môn, Anglesey, came into existence; it was later adopted into English.Anglesey from Ongle's ey, or Ongle's Island. http://www.anglesey-history.co.uk/ In 989 Maredudd ab Owain bribed the Norse not to raid that year. However, the Norse resumed significant raids on Môn in 993, as well as on other parts of Wales for the remainder of the century.

In 999 Maredudd ab Owain of Deheubarth died, and Cynan ap Hywel was able to wrestle back Gwynedd for the Aberffraw dynasty.Lloyd, J. E. A history of Wales: from the earliest times to the Edwardian conquest Cynan ap Hywel, Aeddan ap Blegywryd, However, Cynan himself was deposed by Aeddan ap Blegywryd in 1005. Aeddan was not himself connected to the Aberffraw family, and was perhaps a minor commote lord. Aeddan ruled Gwynedd until 1018, when he and his four sons were defeated in battle by Llywelyn ap Seisyll, lord of Rhuddlan in lower Gwynedd.Davies, John, A History of Wales, Penguin, 1994, Llywelyn ap Seisyll, virtually nothing known of..., married Anghared ferch Meredudd, Iago ab Idwal, Gruffudd kills Iago ab Idwal and takes Gwynedd and Powys pages 99,100Little is known of the ancestry of Llywelyn ap Seisyll, with later genealogists suggesting he was descended from a younger son of Anarawd ap Rhodri, which would make him a member of the Aberffraw house. However, this may be a genealogical construct to legitimise his son Gruffydd ap Llywelyn's rule of Gwynedd later in the 11th century.There is general consensus from the strong association of Llywelyn ap Seisyll and his son Gruffydd ap Llywelyn with the commote of Rhuddlan that they may have been of the ruling family of the Rhuddlan commote.

Llywelyn ap Seisyll married Anghared, daughter of Maredudd ab Owain of Deheubarth, and ruled Gwynedd until his death in 1023, when Iago ab Idwal recovered the rulership of Gwynedd for the senior line of the Aberffraw house. Iago reigned over Gwynedd until 1039, when he was murdered by his own men, perhaps under the direction of Gruffydd of Rhuddlan, Llywelyn ap Seisyll's eldest son.

The Aberffraw heir Cynan ab Iago, who was four years old, escaped with his mother to exile in Dublin.

Gruffydd ap Llywelyn (1039–1063)

Gruffydd ap Llywelyn seized control of Gwynedd in 1039 with the death of Iago ab Idwal and, after taking possession of Powys, struck at Mercia, slaying Edwin of Mercia, brother of Leofric, Earl of Mercia.Lloyd, J. E., A History of Wales: From the Norman Invasion to the Edwardian Conquest, Takes Gwynedd and Powys, attacks Mercia, pg 3, Conquest of South Wales, Alliance with Ælfgar of Mercia pg 4–9, Gruffydd's decisive defeat of the Mercians at the Battle of Rhyd y Groes on the Severn (location unknown) neutralised Mercian incursions on Gwynedd and Powys's eastern borders as many of Mercia's leading magnates were also slain alongside Edwin of Mercia.

Conquest of south Wales

Gruffydd then turned his attention to the conquest of Deheubarth, ruled by his maternal cousin Hywel ab Edwin of the House of Dinefwr. The latter was "by no means easy to dislodge", wrote Lloyd. Gruffydd raided Deheubarth's province of Ceredigion in 1036, ravaging the lands of the monastic community of Llanbadarn Fawr. Hywel of Deheubarth was able to defend Deheubarth against Gruffydd's raids until he was defeated in 1041 at the Battle of Pencader, after which Gruffydd captured Hywel's wife and became master of Ceredigion. Following the Battle of Pencader, Hywel retained Dyfed (Pembrokeshire) and Ystrad Tywi (Carmarthenshire), the heart of Deheubarth. However, he was expelled by Gruffydd in 1043 after an unrecorded event, and sought refuge in Ireland. In 1044 Hywel returned to recover Deheubarth with an army of Hiberno-Norse, but was slain and defeated in the Battle of Aber Tywi by Gruffydd ap Llywelyn.

Between 1044 and 1055 Gruffydd ap Llywelyn fought Gruffydd ap Rhydderch of Gwent for control of Deheubarth. Following the defeat of Hywel by Gruffydd ap Llywelyn, Gruffydd ap Rhydderch of Gwent was able to "stir up" the minor commote lords of Deheubarth on his behalf, and to call up an army to resist Gruffydd ap Llywelyn, wrote Lloyd. By 1046 Gruffydd ap Llywelyn allied with Sweyn Godwinson, Earl of Hereford, and the two of them campaigned in South Wales against Gruffydd of Gwent. In 1047 the lords of Ystrad Tywi, the heart of Deheubarth and the seat of the Dinefwr family, led an army which totally defeated the 150-strong teulu, or household guard, of Gruffydd ap Llywelyn, who was narrowly able to escape. In retaliation against the resurgent nobles of Ystrad Tywi and Dyfed, Gruffydd ap Llywelyn devastated those provinces, but "in vain", wrote John Edward Lloyd, "as his authority in South Wales was ... shattered" by Gruffydd ap Rhydderch of Gwent who was now firmly in control of Ystrad Tywi and Dyfed.

In the summer of 1052 Gruffydd ap Llywelyn raided the Norman settlements in Herefordshire in retaliation for the displacement of his former ally Sweyn Godwinson. Sweyn Godwinson and his family were forced into exile and replaced by the Norman Ralph the Timid. Gruffydd defeated the mixed force of Norman and English sent against his raiding party near Leominster. In 1055 Gruffydd ap Llywelyn defeated and killed his southern rival Gruffydd ap Rhydderch and took possession of Deheubarth, later driving out Meurig ap Hywel and Cadwagan ap Hywel of Gwent, and so becoming master over the whole of Wales.

Wars with England

Gruffydd allied with Ælfgar, Earl of East Anglia (and son of Leofric, Earl of Mercia) who had been dispossessed of his earldom on charges of treason, charges which may or may not have been substantiated.Lloyd, J. E., A History of Wales; From the Norman Invasion to the Edwardian Conquest, Alliance with Ælfgar of East Anglia, Raid of Hereford, Defeat of Bishop Leofgar, King of Wales, Conquests pgs 8–11

On 24 October 1055, Gruffydd, Ælfgar, and Ælfgar's Hiberno-Norse mercenaries attacked the Norman settlement at Hereford, defeating Ralph, Earl of Hereford, and razing Hereford Castle. In the looting which followed, Gruffydd and Ælfgar raided Hereford Cathedral of its rich vessels and furnishings, killing seven of the canons who sought to bar the cathedral doors against the raiders.

Edward the Confessor, King of England, commissioned Harold Godwinson, Earl of Wessex, to respond to Gruffydd's raid on Hereford. However, Harold was unable to penetrate into Wales but for a few miles beyond the Dyffryn Dŵr (Valley of Dore). A peace accord was reached between Gruffydd, Ælfgar, Harold of Wessex, and Edward the Confessor at Billingsley, near Boulston in Archenfield, with Ælfgar regaining his earldom of East Anglia.

Despite the peace of Billingsley, cross-border raids continued. In June 1056 Leofgar, Bishop of Hereford led an army into Wales in revenge for the earlier raid by Gruffydd and Ælfgar.Bishop Leofgar's raiding party also included Ælfoth, Sheriff of Hereford, and other priests of Hereford Cathedral. Gruffydd defeated Bishop Leofgar on 16 June in a battle in Dyffryn Machawy, with the bishop among those slain. The following year the men of Hereford raised another army against the Welsh, but their army was dogged by skirmishes and defeat, and they were obliged to negotiate for a peace.

King of Wales

Gruffydd and his "ever-victorious Welshmen", argued Lloyd, continued to pose a threat to the west of England. In 1056, a treaty was reached between Gruffydd, master of Wales and the Welsh marches, and the leading magnates of England, who included Earl Harold Godwinson, Earl Leofric of Mercia, and Aldred of Worcester (soon to be Archbishop of York). Gruffydd would be recognised in all of his conquests if he would swear fealty to King Edward the Confessor, becoming an "under-king" in a similar manner to the King of Scots. Agreeing to the terms, Gruffydd travelled from Chepstow to Gloucester where he and King Edward the Confessor met, and the treaty terms performed.

From his family seat at Rhuddlan, Gruffydd ruled the whole of Wales as king.