Treaty of Montgomery

The Treaty of Montgomery was an Anglo-Cambrian treaty signed on 29 September 1267 in Montgomeryshire by which Llywelyn ap Gruffudd was acknowledged as Prince of Wales by King Henry III of England (r. 1216–1272). It was the only time an English ruler recognised the right of a ruler of Gwynedd over Wales. Llywelyn's grandfather Llywelyn the Great had previously laid claim to be the effective prince of Wales by using the title "Prince of Aberffraw, Lord of Snowdon" in the 1230s, after subduing all the other Welsh dynasties. Likewise Llywelyn's uncle, Dafydd ap Llywelyn, claimed the title of Prince of Wales during his reign from 1240 to 1246. However, Llywelyn's supremacy in the late 1260s forced recognition of his authority in Wales by an English Crown weakened by internal division.
Conditions of the treaty.
Many of the conditions of the treaty had been anticipated by the Treaty of Pipton (1265) between Llywelyn and Simon de Montfort. The 1267 treaty ceded Builth to Llywelyn, along with Brecon and Gwerthrynion in mid-Wales. The disputed castle of Cefnllys, which Llywelyn had taken from Roger Mortimer in 1262, was restored to Roger with the condition that the land would be tentatively held from Llywelyn, provided Llywelyn could affirm his right to it. Llywelyn was also granted Whittington Castle in modern-day Shropshire, previously held by his grandfather in the 1220s, and received an assurance that no castle would be built at Hawarden for sixty years by Robert of Mold, thus helping to secure the north-eastern border of Wales. The treaty also allowed for the reinstatement of Llywelyn's brother, Dafydd ap Gruffudd, into Welsh society after his defection to England in the early 1260s.
The key text would be seen later by the Lord Edward as 
“XIII. For the principality, lands, homages and grants the prince and his successors will be bound to give fealty, homage and service to the king and his heirs, which he or his predecessors have been accustomed and obliged to give the kings of England.”
Implications.
Though the treaty required Llywelyn to do homage to the king of England for the land, it was in effect an acknowledgement of the power and authority of the prince. However, after the succession of Edward I as king of England in 1272, relations between England and Wales deteriorated, and Edward declared war on Llywelyn in 1276; the Treaty of Aberconwy of 1277 superseded the stipulations laid down at Montgomery and severely curbed Llywelyn's power. In December 1282, fifteen years after the original treaty, the army of Montgomery marched to Builth Wells from Montgomery Castle, to surprise and kill Llywelyn. After 1295 and the final Welsh War of the thirteenth century, the castle became more of a military backwater and prison than a front line fortress.