Dinefwr Castle (sometimes anglicized as Dynevor) is a Welsh castle overlooking the River Tywi near the town of Llandeilo, Carmarthenshire, West Wales. It lies on a ridge on the northern bank of the River Tywi, with a steep drop of several hundred feet to the river. Dinefwr was the chief seat of the kingdom of Deheubarth.
Traditionally, a castle was first constructed on this site by Rhodri the Great, but there are no remains from this period. Dinefwr later became the chief seat of Rhodri's grandson Hywel Dda, first ruler of Deheubarth and later king of most of Wales. Rhys ap Gruffydd, ruler of Deheubarth from 1155 to 1197 is thought to have rebuilt the castle. Giraldus Cambrensis tells a story about a plan by King Henry II of England to assault the castle during a campaign against Rhys. One of Henry's most trusted followers was sent on a reconnaissance mission, guided by a local Welsh cleric. The cleric was asked to lead him to the castle by the easiest route, but instead took the most difficult route he could find, ending the performance by stopping to eat grass with the explanation that this was the diet of the local people in times of hardship. The planned attack was duly abandoned.
On Rhys ap Gruffydd's death the castle passed to his son Rhys Gryg, and the earliest parts of the present castle are thought to derive from this period. Llywelyn the Great of Gwynedd was now extending his infuence to this area, and Rhys, finding himself unable to resist, dismantled the castle. Llywelyn however had it restored and held it until his death in 1240. In 1255 Llywelyn the Last gave Dinefwr to Rhys Fychan, then later gave it to Maredudd ap Rhys before later returning it to Rhys Fychan. Maredydd now allied himself to King Edward I of England, and helped Edward capture Dinefwr in 1277. Maredudd had apparently been promised Dinefwr in return for his help, but Edward did not keep his promise and had Maredudd executed in 1291.
The castle now came into English hands, though it is recorded to have been burnt during the rebellion of Llywelyn Bren in 1316. In 1317 it was given to Hugh Despenser, the king's favourite. It was unsuccessfully besieged by the forces of Owain Glyndŵr in 1403. Towards the end of the 15th century the castle was held by Sir Rhys ap Thomas, who carried out extensive rebuilding. In 1531 his granson was executed for treason and the castle was confiscated by the crown, though the family were later able to recover it. Around 1600 a house was built nearby and the castle abandoned.
The castle is in the care of Cadw but lies within Dinefwr Park, which is owned by the National Trust. Visitors who wish to see the castle have to pay for admission to the park, if not National Trust members.