

Wales
Having lost much of what is now the West Midlands to Mercia in the 6th and early 7th centuries, a resurgent late-7th-century Powys checked Mercian advances. Aethelbald of Mercia, looking to defend recently acquired lands, had built Wat’s Dyke. According to Davies, this have been with the agreement of king Elisedd ap Gwylog of Powys, as this boundary, extending north from the valley of the River Severn to the Dee estuary, gave him Oswestry. Another theory, after carbon dating placed the dyke’s existence 300 years earlier, is that it was built by the post-Roman rulers of Wroxeter. King Offa of Mercia seems to have continued this initiative when he created a larger earthwork, now known as Offa’s Dyke (Clawdd Offa). Davies wrote of Cyril Fox‘s study of Offa’s Dyke: “In the planning of it, there was a degree of consultation with the kings of Powys and Gwent. On the Long Mountain near Trelystan, the dyke veers to the east, leaving the fertile slopes in the hands of the Welsh; near Rhiwabon, it was designed to ensure that Cadell ap Brochwel retained possession of the Fortress of Penygadden.” And, for Gwent, Offa had the dyke built “on the eastern crest of the gorge, clearly with the intention of recognizing that the River Wye and its traffic belonged to the kingdom of Gwent.” However, Fox’s interpretations of both the length and purpose of the Dyke have been questioned by more recent research.
In 853, the Vikings raided Anglesey, but in 856, Rhodri Mawr defeated and killed their leader, Gorm. The Britons of Wales made peace with the Vikings and Anarawd ap Rhodri allied with the Norsemen occupying Northumbria to conquer the north. This alliance later broke down and Anarawd came to an agreement with Alfred, king of Wessex, with whom he fought against the west Welsh. According to Annales Cambriae, in 894, “Anarawd came with the Angles and laid waste Ceredigion and Ystrad Tywi.”
Medieval Wales:
From 800 onwards, a series of dynastic marriages led to Rhodri Mawr‘s (r. 844–77) inheritance of Gwynedd and Powys. His sons founded the three dynasties of (Aberffraw for Gwynedd, Dinefwr for Deheubarth and Mathrafal for Powys). Rhodri‘s grandson Hywel Dda (r. 900–50) founded Deheubarth out of his maternal and paternal inheritances of Dyfed and Seisyllwg in 930, ousted the Aberffraw dynasty from Gwynedd and Powys and then codified Welsh law in the 940s. Maredudd ab Owain (r. 986–99) of Deheubarth, (Hywel‘s grandson), temporarily ousted the Aberffraw line from control of Gwynedd and Powys. Maredudd‘s great-grandson (through his daughter Princess Angharad) Gruffydd ap Llywelyn (r. 1039–63) conquered his cousins’ realms from his base in Powys, and extended his authority into England. 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 Gruffydd ap Llywelyn. For about seven brief years, Wales was one, under one ruler, a feat with neither precedent nor successor.” Owain Gwynedd (1100–70) of the Aberffraw line was the first Welsh ruler to use the title princeps Wallensium (prince of the Welsh), a title of substance given his victory on the Berwyn Mountains, according to John Davies.