Caerphilly Castle was built by the 7th Earl of Gloucester, Gilbert de Clare, starting in 1268. In the early stages, Llywelyn ap Gruffydd, the last Prince of Wales burned it, believing it encroached on his land. These events are related (spoiler!) in Daughter of Time from the After Cilmeri series. Just as a side note to begin, Caerphilly is spelled by CADW, the Welsh historical preservation society with a ‘y’ at the end, not an ‘i’ as it might be in Welsh.
Llywelyn actually attacked the castle twice during its construction, but ultimately had to give way to the power of the Normans. Even today, Caerphilly is the largest castle in Wales and second only to Windsor in size in all of Britain. One historian has described Caerphilly as “having the most extensive water-defenses” of any castle, covering 30 acres and likely inspired by similar defenses at Kenilworth. Caerphilly was the first concentric castle in Wales, meaning it had two curtain walls, the outer one lower than the inner to facilitate its defense, and was known for its massive gatehouses. Caerphilly’s inner defenses are roughly square, with a middle and inner ward, protected by turrets. The inner ward contained the castle’s great hall, now restored, private apartments for the castle owners, the buttery, and a chapel.
Caerphilly was also attacked during the uprising of Madog ap Llywelyn in 1294, again in 1316 during the revolt of Llywelyn Bren, and then again during the overthrow of Edward II. By the 15th century, it was in decline, and was eventually ruined.