Caerphilly Castle is a medieval fortification in Caerphilly in South Wales. The castle was constructed by Gilbert de Clare in the 13th century as part of his campaign to maintain control of Glamorgan, and saw extensive fighting between Gilbert, his descendants, and the native Welsh rulers. Surrounded by extensive artificial lakes – considered by historian Allen Brown to be "the most elaborate water defences in all Britain" – it occupies around 30 acres and is the largest castle in Wales and the second-largest castle in the United Kingdom after Windsor Castle. It is famous for having introduced concentric castle defences to Britain and for its large gatehouses. Gilbert began work on the castle in 1268 following his occupation of the north of Glamorgan, with the majority of the construction occurring over the next three years at a considerable cost. The project was opposed by Gilbert's Welsh rival Llywelyn ap Gruffudd, leading to the site being burnt in 1270 and taken over by royal officials in 1271. Despite these interruptions, Gilbert successfully completed the castle and took control of the region.