Cardiff Castle is a medieval castle and Victorian Gothic revival mansion located in the city centre of Cardiff, Wales. The original motte and bailey castle was built in the late 11th century by Norman invaders on top of a 3rd-century Roman fort. The castle was commissioned by either William the Conqueror or by Robert Fitzhamon, and formed the heart of the medieval town of Cardiff and the Marcher Lord territory of Glamorgan. In the 12th century the castle began to be rebuilt in stone, probably by Robert of Gloucester, with a shell keep and substantial defensive walls being erected. Further work was conducted by Richard de Clare in the second half of the 13th century. Cardiff Castle was repeatedly involved in the conflicts between the Anglo-Normans and the Welsh, being attacked several times in the 12th century, and stormed in 1404 during the revolt of Owain Glyndŵr.
After being held by the de Clare and Despenser families for several centuries the castle was acquired by Richard de Beauchamp in 1423. Richard conducted extensive work at the castle, founding the main range on the west side of the castle, dominated by a tall, octagonal tower. Following the Wars of the Roses the status of the castle as a Marcher territory was revoked and its military significance began to decline. The Herbert family took over the property in 1550, remodelling parts of the main range and carrying out construction work in the outer bailey, then occupied by Cardiff's Shire Hall and other buildings. During the English Civil War Cardiff Castle was initially taken by Parliamentary force, but was regained by Royalist supporters in 1645. When fighting broke out again in 1648, a Royalist army attacked Cardiff in a bid to regain the castle, leading to the battle of St Fagans just outside the city. Cardiff Castle escaped potential destruction by Parliament after the war and was instead garrisoned to protect against a possible Scottish invasion.
In the mid-18th century, Cardiff Castle passed into the hands of the Marquesses of Bute. John Stuart, the first Marquess, employed Capability Brown and Henry Holland to renovate the main range, turning it into a Georgian mansion, and to landscape the castle grounds, demolishing many of the older medieval buildings and walls. During the first half of the 19th century the family became extremely wealthy as a result of the growth of the coal industry in Glamorgan. The third Marquess, John Crichton-Stuart, used this wealth to back an extensive programme of renovations under William Burges. Burges remodelled the castle in a Gothic revival style, lavishing money and attention on the main range. The resulting interior designs are considered to be amongst "the most magnificent that the gothic revival ever achieved". The grounds were re-landscaped and, following the discovery of the old Roman remains, reconstructed walls and a gatehouse in a Roman style were incorporated into the castle design. Extensive landscaped parks were built around the outside of the castle.
In the early 20th century the fourth Marquess inherited the castle and construction work continued into the 1920s. The Bute lands and commercial interests around Cardiff were sold off or nationalised during the period until, by the time of the Second World War, little was left except the castle. During the war, extensive air raid shelters were built in the castle walls, able to hold up to 1,800 people. When the Marquess died in 1947, the castle was given to the city of Cardiff. Today the castle is run as a tourist attraction, with the grounds housing the "" regimental museum and interpretation centre. The castle has also served as a venue for events, including musical performances and festivals.