Edinburgh Castle is a historic fortress which dominates the skyline of Edinburgh, the capital city of Scotland, from its position on the Castle Rock. Archaeologists have established human occupation of the rock since at least the Iron Age (2nd century AD), although the nature of the early settlement is unclear. There has been a royal castle on the rock since at least the reign of David I in the 12th century, and the site continued at times to be a royal residence until 1633. From the 15th century, the castle's residential role declined, and by the 17th century it was principally used as military barracks with a large garrison. Its importance as a part of Scotland's national heritage was recognised increasingly from the early 19th century onwards, and various restoration programmes have been carried out over the past century and a half. As one of the most important strongholds in the Kingdom of Scotland, Edinburgh Castle was involved in many historical conflicts from the Wars of Scottish Independence in the 14th century to the Jacobite rising of 1745. Research undertaken in 2014 identified 26 sieges in its 1100-year-old history, giving it a claim to having been 'the most besieged place in Great Britain and one of the most attacked in the world'.
Few of the present buildings pre-date the Lang Siege of the 16th century when the medieval defences were largely destroyed by artillery bombardment. The most notable exceptions are St Margaret's Chapel from the early 12th century, which is regarded as the oldest building in Edinburgh, the Royal Palace and the early-16th-century Great Hall, although the interiors have been much altered from the mid-Victorian period onwards. The castle also houses the Scottish regalia, known as the Honours of Scotland and is the site of the Scottish National War Memorial and the National War Museum of Scotland. The British Army is still responsible for some parts of the castle, although its presence is now largely ceremonial and administrative. Some of the castle buildings house regimental museums which contribute to its presentation as a tourist attraction.
The castle, in the care of Historic Environment Scotland, is Scotland's most and the United Kingdom's second most-visited paid tourist attraction, with over 2.1 million visitors in 2018 and over 70 percent of leisure visitors to Edinburgh visiting the castle. As the backdrop to the Edinburgh Military Tattoo during the annual Edinburgh Festival, the castle has become a recognisable symbol of Edinburgh and Scotland.and Scotland.
The castle stands upon the plug of an extinct volcano, which is estimated to have risen about 350 million years ago during the lower Carboniferous period. The Castle Rock is the remains of a volcanic pipe, which cut through the surrounding sedimentary rock before cooling to form very hard dolerite, a type of basalt. Subsequent glacial erosion was resisted by the dolerite, which protected the softer rock to the east, leaving a crag and tail formation.
The summit of the Castle Rock is 130 metres (430ft) above sea level, with rocky cliffs to the south, west, and north, rising to a height of 80 metres (260ft) above the surrounding landscape. This means that the only readily accessible route to the castle lies to the east, where the ridge slopes more gently. The defensive advantage of such a site is self-evident, but the geology of the rock also presents difficulties, since basalt is extremely impermeable. Providing water to the Upper Ward of the castle was problematic, and despite the sinking of a 28-metre (92ft) deep well, the water supply often ran out during drought or siege, including during the Lang Siege in 1573.
Archaeological investigation has yet to establish when the Castle Rock was first used as a place of human habitation. There is no record of any Roman interest in the location during General Agricola's invasion of northern Britain near the end of the 1st century AD. Ptolemy's map of the 2nd century AD shows a settlement in the territory of the Votadini named 'Alauna', meaning 'rock place', making this possibly the earliest known name for the Castle Rock. This could, however, refer to another of the tribe's hill forts in the area. The Orygynale Cronykil of Andrew of Wyntoun (c. 1350 – c. 1423), an early source for Scottish history, names 'Ebrawce' (Ebraucus), a legendary King of the Britons, as having 'byggyd [built] Edynburgh'. According to the earlier chronicler, Geoffrey of Monmouth (c. 1100 – c. 1155), Ebraucus had fifty children by his twenty wives, and was the founder of 'Kaerebrauc' (York), 'Alclud' (Dumbarton) and the 'Maidens' Castle'. The 16th-century English writer John Stow (c. 1525 – 1605), credited Ebraucus with building 'the Castell of Maidens called Edenbrough' in 989 BC. The name 'Maidens' Castle' (Latin: Castra or Castellum Puellarum) occurs frequently up until the 16th century. It appears in charters of David I (r. 1124–1153) and his successors, although the reason for it is not known. William Camden's survey of Britain, Britannia (1607), records that 'the Britans called [it] Castle Myned Agned [winged rock], the Scots, the Maidens Castle and the Virgins Castle, of certaine young maidens of the Picts roiall bloud who were kept there in old time'. According to the 17th-century antiquarian Father Richard Hay, the 'maidens' were a group of nuns, who were ejected from the castle and replaced by canons, considered 'fitter to live among soldiers'. However, this story was considered 'apocryphal' by the 19th-century antiquarian Daniel Wilson and has been ignored by historians since. The name may have been derived from a 'Cult of the Nine Maidens' type of legend. Arthurian legends suggest that the site once held a shrine to Morgain la Fee, one of nine sisters. Later, St Monenna, said to be one of nine companions, reputedly invested a church at Edinburgh, as well as at Dumbarton and other places. Similar names are shared by many other Iron Age hillforts and may have simply described a castle that had never been taken by force or derived from an earlier Brittonic name like mag dun.
An archaeological excavation in the early 1990s uncovered evidence of the site having been settled during the late Bronze Age or early Iron Age, potentially making the Castle Rock the longest continually occupied site in Scotland. However, the extent of the finds was not particularly significant and was insufficient to draw any certain conclusions about the precise nature or scale of this earliest known phase of occupation.
The archaeological evidence is more reliable in respect of the Iron Age. Traditionally, it had been supposed that the tribes of central Scotland had made little or no use of the Castle Rock. Excavations at nearby Dunsapie Hill, Duddingston, Inveresk and Traprain Law had revealed relatively large settlements and it was supposed that these sites had been chosen in preference to the Castle Rock. However, the excavation in the 1990s pointed to the probable existence of an enclosed hill fort on the rock, although only the fringes of the site were excavated. House fragments revealed were similar to Iron Age dwellings previously found in Northumbria.
The 1990s dig revealed clear signs of habitation from the 1st and 2nd centuries AD, consistent with Ptolemy's reference to 'Alauna'. Signs of occupation included some Roman material, including pottery, bronzes and brooches, implying a possible trading relationship between the Votadini and the Romans beginning with Agricola's northern campaign in AD 82, and continuing through to the establishment of the Antonine Wall around AD 140. The nature of the settlement in this period is inconclusive, but Driscoll and Yeoman suggest it may have been a broch, similar to the one at Edin's Hall near Duns in the Scottish Borders.
The castle does not re-appear in contemporary historical records from the time of Ptolemy until around AD 600. Then, in th...