Aberystwyth Castle was built in response to the First Welsh War in the late 13th century, replacing an earlier Motte and bailey castle located a mile to the south. The current castle was rebuilt in its current location by Edward I of England in 1277 after the end of the first war against Llywelyn ap Gruffydd Llywelyn the Great's grandson. The Welsh took the castle in 1282 at the start of the 1282 war and burned both the castle and the town. Under master mason James of St George, the castle was eventually completed in 1289, though it was sieged extensively during the revolt of Madog ap Llywelyn in 1294–5.
During a national uprising by Owain Glyndŵr, the Welsh captured the castle in 1404, but it was recaptured by the English four years later. In 1637 it became a Royal mint by Charles I, and produced silver shillings. The castle was slighted by Oliver Cromwell in 1649.
References:The Château de Foix dominates the town of Foix. An important tourist site, it is known as a centre of the Cathars. Built on an older 7th-century fortification, the castle is known from 987. In 1002, it was mentioned in the will of Roger I, Count of Carcassonne, who bequeathed the fortress to his youngest child, Bernard. In effect, the family ruling over the region were installed here which allowed them to control access to the upper Ariège valley and to keep surveillance from this strategic point over the lower land, protected behind impregnable walls.
In 1034, the castle became capital of the County of Foix and played a decisive role in medieval military history. During the two following centuries, the castle was home to Counts with shining personalities who became the soul of the Occitan resistance during the crusade against the Albigensians.