The Kingdom of Gwynedd was a Welsh kingdom which first appeared at the turn of the sixth century. Based in northwest Wales, the rulers of Gwynedd repeatedly rose to dominance and were acclaimed as "King of the Britons" before losing their power in civil wars or invasions. The kingdom of Gruffudd ap Llywelyn—the King of Wales from 1055 to 1063—was shattered by a Saxon invasion in 1063 just prior to the Norman invasion of Wales, but the House of Aberffraw restored by Gruffudd ap Cynan slowly recovered and Llywelyn the Great of Gwynedd was able to proclaim the Principality of Wales at the Aberdyfi gathering of Welsh princes in 1216. In 1277, the Treaty of Aberconwy between Edward I of England and Llywelyn's grandson Llywelyn ap Gruffudd granted peace between the two but would also guarantee that Welsh self-rule would end upon Llywelyn's death, and so it represented the completion of the first stage of the conquest of Wales by Edward I.
Welsh tradition credited the founding of Gwynedd to the Brittonic polity of Gododdin (Old Welsh Guotodin, earlier Brittonic form Votadini) from Lothian invading the lands of the Brittonic polities of the Deceangli, Ordovices, and Gangani in the 5th century. The sons of their leader, Cunedda, were said to have possessed the land between the rivers Dee and Teifi. The true borders of the realm varied over time, but Gwynedd proper was generally thought to comprise the cantrefs of Aberffraw, Cemais, and Cantref Rhosyr on Anglesey and Arllechwedd, Arfon, Dunoding, Dyffryn Clwyd, Llŷn, Rhos, Rhufoniog, and Tegeingl at the mountainous mainland region of Snowdonia opposite.