The Laws of Hywel Dda, codifed formally before 950 AD.  The historical consensus is that the laws had been effect for  hundreds of years, but Hywel Dda ruled much of Wales and that allowed a more cohesive approach to the law.

“Most of the surviving manuscripts of Welsh law start with a preamble explaining how the laws were codified by Hywel. The introduction to the Book of Blegywryd is a typical example:

Hywel the Good, son of Cadell, by the grace of God, king of all Wales… summoned to him from every commote of his kingdom six men who were practised in authority and jurisprudence… to the place called the White House on the Taf in Dyfed. … And at the end of Lent the king selected from that assembly the twelve most skilled laymen of his men and the one most skilled scholar who was called Master Blegywryd, to form and interpret for him and for his kingdom, laws and usages…[1]
The description of Hywel as “king of all Wales” suggests a date between 942 and Hywel’s death in 950 for this council. However the Welsh laws have many points of similarity to the Brehon laws in Ireland and some parts probably date from long before Hywel’s time. What was produced by Hywel’s council was not a set of entirely new laws, rather as described in the preamble to the Book of Iorwerth:
And by the common counsel and agreement of the wise men who came there they examined the old laws, and some of them they allowed to continue, others they amended, others they wholly deleted, and others they laid down anew

A surviving manuscript (from the thirteenth century) is in the National Library of Wales. It was a ‘pocket’ book, designed for lawyers to carry around in their scrip, rather than left on a library shelf.
You can view it here:

Later on, with the Norman Conquest, Welsh law proved to be a rallying point for the Welsh resistance. The Normans objected to many of the laws (paying money instead of a sentence of death for various crimes, the status of women, divorce, etc), but the most contentious of all were rights of inheritance.  In Wales, illegitimate sons and legitimate ones were treated identically.

That’s worth repeating, by Welsh law, illegitimate sons would inherit equally with legitimate ones.  In my book,  The Good Knight, Prince Rhun, as the oldest, was his father’s favorite.  If Owain Gwynedd had died in 1246, most likely Rhun and Hywel, both illegimate sons, would have split the kingdom between them in some fashion, possibly with Rhun taking precedence.  Each of Owain’s other sons would have received something, but only Iorwerth might have been of age by that point. “The law of the church says that no-one is entitled to patrimony save the father’s eldest son by his wedded wife. The law of Hywel adjudges it to the youngest son as to the eldest, and judges that the father’s sin and his illegality should not be set against the son for his patrimony.”

The consequences of upholding this law were varied.  For the Welsh themselves, it meant that kingdoms were split among many sons and son fought son to consolidate their inheritance.  This wasn’t necessarily a good thing, but it did mean that if the eldest son was less fit to rule than a younger son, that younger son could triumph (Llywelyn ap Gruffydd is a case in point).

The Church viewed this aspect of Welsh law as a horrifying deviance from Holy Scripture:  “When he wrote to Llywelyn ap Gruffydd in October 1279 complaining of the Prince’s infringement of liberties of the Church, Peckham showed knowledge of the laws of Hywel Dda, though only by hearsay: ‘contra quae opponitis leges Howeli Da, quae Decalogo dicuntur in diversis articulis obviare’. When, in November 1282, after the terms of peace proposed by him had been rejected, Peckham sent his letter of general denunciation of the morality of Llywelyn and the Welsh, he twice referred to the laws of Howelda and makes it clear that this time it was a written text he had seen: ‘ac Howelda in lege sua, quam vidimus’.  In this letter Peckham included among the sins of the Welsh their casual regard for the indissolubility of marriage and their allowing inheritance to illegitimate offspring.”