Last updated: 24 November 2010
Unlike the castles in Harlech and Caernarfon, Caerphilly Castle was not built by the master castle builder Edward I, but by the nobleman Gilbert 'The Red' de Clare, Lord of Glamorgan.
It was built to defend against Llywelyn ap Gruffydd ('Llywelyn The Last'), the last Prince of a united Wales before the conquest of Edward I.
Llywelyn was largely integrated into British nobility, but had a long-running dispute with de Clare, who built Caerphilly Castle between 1268 and 1271 to defend against him.
The castle was, and still is, huge. It was Britain's first concentric castle, with a ring of shallow lakes surrounding it. It is one of the biggest fortresses in Europe, and the second largest in Britain, behind only Windsor Castle.
King Henry III mediated in the dispute between Llywelyn and de Clare and sent a bishop to control the fortress, but de Clare regained control of it. Luckily for him, Llywelyn fell into the subsequent king's disfavour when he failed on five occasions to provide Edward I with services demanded.
Llywelyn was stripped of his lordship and Edward took his lands. Thus, de Clare's need for such a strong castle was drastically diminished and it was used instead by the family and later the Despensers as a headquarters for their operations.
Its usefulness as a home and defence diminished, and by the 15th century, it was gradually vacated. Subsequent owners kept up maintenance, but this more or less petered out by the end of the century. Its eastern gatehouse was used as a prison.
After the Civil War, in which it played little part, Oliver Cromwell decreed that the castle be slighted. The damage caused resulted in the famous 'leaning' south-east tower, which can be seen today.
Like many other Welsh castles, Caerphilly fell into ever more disrepair between military use and modern conservation.
It was the Bute family who finally took the upkeep of this monumental castle upon themselves in the 18th century. The first Marquis of Bute began the work, which continued until it was handed over to the government in 1950.
Explore the celebrated and lesser-known incidents in Welsh history, watch rare clips from BBC Wales' own archive, find out about history events in Wales.
Missed an episode? Catch up on the BBC iPlayer.
Tracing your Welsh roots? Pick up some tips in our guides.