Originally a motte and bailey castle, built 1109 by Walter, Sheriff of Gloucester, attacked unsuccessfully by Gruffydd Ap Rhys in 1116, destroyed in 1137, and rebuilt by Gilbert fitz Richard, Earl of Pembroke, in 1145. Re-captured in 1146, it was strengthened by Cadell ap Gruffydd in 1150, returned to English royal control, it was probably first rebuilt in stone, resisting attack by the Lord Rhys in 1190 and 1196, but taken by Llywelyn the Great in 1215. William Marshall the younger retook the castle 1223, and returned it to royal hands after some repairs in 1226. In 1233, it withstood a 3-month siege by Llywelyn, and was not captured when the town was pillaged in 1244 and 1246. In 1248 given to custody of Robert Waleran who is recorded as adding a hall and chamber, and in 1258, after the massacre of an English army from Carmarthen at Coed Lathen in 1257, bestowed on Prince Edward, later Edward I. A survey in 1275 referred to a great tower, 5 small towers, hall, kitchen stable and chapel, all surrounded by a stone wall with one gate, and in need of repair. The castle became the seat of royal government in S Wales with the appointment of Bogo de Knovill as Justiciar of S Wales, 1280. Rhys ap Maredudd pillaged the town but did not take the castle in 1287, the castle was repaired in 1288 for £169/15/3d (£169.76). Repaired and added to in the C14 with very substantial royal apartments and administrative rooms: in the C14 the list included King's hall and chambers, King's chapel, Queen's apartments, Chamberlain's hall, chapel for knights and esquires, Exchequer offices, kitchens, granary, wine cellar, armoury and stables. In 1340 the chamberlain's hall was repaired, in 1355 a wine-cellar made under the hall, and another hall had been added by 1370. A gate and chamber between the 2 wards of the castle had been completed by 1394. The Black Prince was granted the lordship in 1343 and visited in 1351, 1362 and 1370. Richard II visited in 1399. The castle was captured by Owain Glyndwr in 1405, having sacked the town in 1403. In 1409 over £380 was spent on repairs - nearly £100 on rebuilding the gatehouse. Important during the Wars of the Roses, it was granted to Sir Rhys ap Thomas (d 1525) as Chief Justice of S. Wales. During the Civil War, the castle was captured by the Parliamentarians under General Laugharne in 1644, but retaken by Royalist forces. By 1648, Laugharne had changed sides, and Cromwell halted at Carmarthen, probably then ordering the slighting of the castle, described in 1660 as ''quite demolished''. In 1789-92, John Nash's County Gaol was built on the E side within the curtain wall, for which much of the remains were demolished. A section of the original castle collapsed c.1811. The gaol was extended over the years, and covered most of the site. From 1938, the construction of the County Hall obliterated any remains on the gaol site within the curtain walls.