Edinburgh Castle Edinburgh Castle is an historic fortress which dominates the skyline of the city of Edinburgh , 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 to be a royal residence until the Union of the Crowns in 1603 . 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 . It has been besieged , both successfully and unsuccessfully , on several occasions . 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 museum s which contribute to its presentation as a tourist attraction . The castle is in the care of Historic Scotland and is Scotland ' s most - visited paid tourist attraction , with over 1 . 2 million visitors in 2011 . As the backdrop to the Edinburgh Military Tattoo during the annual Edinburgh International Festival the castle has become a recognisable symbol of Edinburgh and of Scotland . History . Pre - history of the Castle Rock . Geology . The castle stands upon the plug of an extinct volcano , which is estimated to have risen some 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 above sea level , with rocky cliffs to the south , west and north , rising to a height of 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 deep well , the water supply often ran out during drought or siege , for example during the Lang Siege in 1573 . Earliest habitation . 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 " Maiden Castle " ( Latin " 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 legend s 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 . More simply , the term " Maiden Castle " may have implied a castle that had never been taken by force . 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 . Early Middle Ages . The castle does not re - appear in contemporary historical records from the time of Ptolemy until around AD 600 . Then , in the epic Welsh poem " Y Gododdin " there is a reference to " Din Eidyn " , " the stronghold of Eidyn " . This has been generally assumed to refer to the Castle Rock . The poem tells of the Gododdin King Mynyddog Mwynfawr , and his band of warriors , who , after a year of feasting in their fortress , set out to do battle with the Angles at " Catreath " ( possibly Catterick ) in Yorkshire . Despite performing glorious deeds of valour and bravery , the poem relates that the Gododdin were massacred . The Irish annals record that in 638 , after the events related in " Y Gododdin " , " Etin " was besieged by the Angles under Oswald of Northumbria , and the Gododdin were defeated . The territory around Edinburgh then became part of the Kingdom of Northumbria , which was itself absorbed by England in the 10th century , when Athelstan of England , according to the Annals of Clonmacnoise , " spoiled the Kingdom to Edinburgh " . The English withdrew , and Lothian became part of Scotland , during the reign of Indulf ( r . 954 – 962 ) . The archaeological evidence for the period in question is based entirely on the analysis of midden s ( domestic refuse heaps ) , with no evidence of structures . Few conclusions can therefore be derived about the status of the settlement during this period , although the midden deposits show no clear break since Roman times . High Middle Ages . The first documentary reference to a castle at Edinburgh is John of Fordun ' s account of the death of King Malcolm III . Fordun describes his widow , the future Saint Margaret , as residing at the " Castle of Maidens " when she is brought news of his death in November 1093 . Fordun ' s account goes on to relate how Margaret died of grief within days , and how Malcolm ' s brother Donald Bane laid siege to the castle . However , Fordun ' s chronicle was not written until the later 14th century , and the near - contemporary account of the life of St Margaret by Bishop Turgot makes no mention of a castle . During the reigns of Malcolm III and his sons , Edinburgh Castle became one of the most significant royal centres in Scotland . Malcolm ' s son King Edgar died here in 1107 . Malcolm ' s youngest son , King David I ( r . 1124 – 1153 ) , developed Edinburgh as a seat of royal power principally through his administrative reforms ( termed by some modern scholars the Davidian Revolution ) . Between 1139 and 1150 , David held an assembly of nobles and churchmen , a precursor to the parliament of Scotland , at the castle . Any buildings or defences would probably have been of timber , although two stone buildings are documented as having existed in the 12th century . Of these , St . Margaret ' s Chapel remains at the summit of the rock . The second was a church , dedicated to St . Mary , which stood on the site of the Scottish National War Memorial . Given that the southern part of the Upper Ward ( where Crown Square is now sited ) was not suited to being built upon until the construction of the vaults in the 15th century , it seems probable that any earlier buildings would have been located towards the northern part of the rock ; that is around the area where St . Margaret ' s Chapel stands . This has led to a suggestion that the chapel is the last remnant of a square , stone keep , which would have formed the bulk of the 12th - century fortification . The structure may have been similar to the keep of Carlisle Castle , which David I began after 1135 . David ' s successor King Malcolm IV ( r . 1153 – 1165 ) reportedly stayed at Edinburgh more than at any other location . But in 1174 , King William " the Lion " ( r . 1165 – 1214 ) was captured by the English at the Battle of Alnwick . He was forced to sign the Treaty of Falaise to secure his release , in return for surrendering Edinburgh Castle , along with the castles of Berwick , Roxburgh and Stirling , to the English King , Henry II . The castle was occupied by the English for twelve years , until 1186 , when it was returned to William as the dowry of his English bride , Ermengarde de Beaumont , who had been chosen for him by King Henry . By the end of the 12th century , Edinburgh Castle was established as the main repository of Scotland ' s official state papers . Wars of Scottish Independence . A century later , in 1286 , on the death of King Alexander III , the throne of Scotland became vacant . Edward I of England was appointed to adjudicate the competing claims for the Scottish crown , but used the opportunity to attempt to establish himself as the feudal overlord of Scotland . During the negotiations , Edward stayed briefly at Edinburgh Castle and may have received homage there from the Scottish nobles . In March 1296 , Edward I launched an invasion of Scotland , unleashing the First War of Scottish Independence . Edinburgh Castle soon came under English control , surrendering after a three days long bombardment . Following the siege , Edward had many of the Scottish legal records and royal treasures moved from the castle to England . A large garrison numbering 325 men was installed in 1300 . Edward also brought to Scotland his master builders of the Welsh castles , including Thomas de Houghton and Master Walter of Hereford , both of whom travelled from Wales to Edinburgh . After the death of Edward I in 1307 , however , England ' s control over Scotland weakened . On 14 March 1314 , a surprise night attack by Thomas Randolph , 1st Earl of Moray recaptured the castle . John Barbour ' s narrative poem " The Brus " relates how a party of thirty hand - picked men were guided by one William Francis , a member of the garrison who knew of a route along the north face of the Castle Rock and a place where the wall might be scaled . Making the difficult ascent , Randolph ' s men scaled the wall , surprised the garrison and took control . Robert the Bruce immediately ordered the destruction of the castle ' s defences to prevent its re - occupation by the English . Four months later , his army secured victory at the Battle of Bannockburn . After Bruce ' s death in 1329 , Edward III of England determined to renew the attempted subjugation of Scotland and supported the claim of Edward Balliol , son of the former King John Balliol , over that of Bruce ' s young son David II . Edward invaded in 1333 , marking the start of the Second War of Scottish Independence , and the English forces reoccupied and refortified Edinburgh Castle in 1335 , holding it until 1341 . This time , the Scottish assault was led by William Douglas , Lord of Liddesdale . Douglas ' s party disguised themselves as merchants from Leith bringing supplies to the garrison . Driving a cart into the entrance , they halted it there to prevent the gates closing . A larger force hidden nearby rushed to join them and the castle was retaken . The English garrison , numbering 100 , were all killed . David ' s Tower and the 15th century . The 1357 Treaty of Berwick brought the Wars of Independence to a close . David II resumed his rule and set about rebuilding Edinburgh Castle which became his principal seat of government . David ' s Tower was begun around 1367 , and was incomplete when David died at the castle in 1371 . It was completed by his successor , Robert II , in the 1370s . The tower stood on the site of the present Half Moon Battery and was connected by a section of curtain wall to the smaller Constable ' s Tower , a round tower built between 1375 and 1379 where the Portcullis Gate now stands . In the early 15th century , another English invasion , this time under Henry IV , reached Edinburgh Castle and began a siege , but eventually withdrew due to lack of supplies . From 1437 , Sir William Crichton was Keeper of Edinburgh Castle , and soon after became Chancellor of Scotland . In an attempt to gain the regency of Scotland , Crichton sought to break the power of the Douglases , the principal noble family in the kingdom . The sixteen - year - old William Douglas , 6th Earl of Douglas and his younger brother David were summoned to Edinburgh Castle in November 1440 . After the so - called " Black Dinner " had taken place in David ' s Tower , both boys were summarily executed on trumped - up charges in the presence of the ten - year - old King James II ( r . 1437 – 1460 ) . Douglas ' supporters subsequently besieged the castle , inflicting damage . Construction continued throughout this period , with the area now known as Crown Square being laid out over vaults in the 1430s . Royal apartments were built , forming the nucleus of the later palace block , and a Great Hall was in existence by 1458 . In 1464 , access to the castle was improved when the current approach road up the north - east side of the rock was created to allow easier movement of the royal artillery train in and out of the area now known as the Upper Ward . In 1479 , Alexander Stewart , Duke of Albany , was imprisoned in David ' s Tower for plotting against his brother , King James III ( r . 1460 – 1488 ) . He escaped by getting his guards drunk , then lowering himself from a window on a rope . Albany fled to France , then England , where he allied himself with King Edward IV . In 1482 , Albany marched into Scotland with Richard , Duke of Gloucester ( later King Richard III ) and an English army . James III was trapped in the castle from 22 July to 29 September 1482 until he successfully negotiated a settlement . During the 15th century the castle was increasingly used as an arsenal and armaments factory . The first known purchase of a gun was in 1384 , and the " great bombard " Mons Meg was delivered to Edinburgh in 1457 . The first recorded mention of an armoury for the manufacture of guns occurs in 1474 , and by 1498 the master gunner Robert Borthwick was casting bronze guns at Edinburgh . By 1511 Edinburgh was the principal foundry in Scotland , supplanting Stirling Castle , with Scottish and European smiths working under Borthwick , who by 1512 was appointed " master melter of the king ' s guns " . Their output included guns for the Scottish flagship , the " " Great Michael " " , and the " Seven Sisters " , a set of cannon captured by the English at Flodden in 1513 . Sir Thomas Howard , England ' s Lord Admiral , admired their graceful shape and brilliant finish , declaring them the most beautiful [ cannon ] for their size and length that he had ever seen . From 1510 Dutch craftsmen were also producing hand culverin s , an early firearm . After Flodden , Borthwick continued his work , producing an unknown number of guns , of which none survive . He was succeeded by French smiths , who began manufacturing hagbut s ( another type of firearm ) in the 1550s , and by 1541 the castle had a stock of 413 . Meanwhile , the royal family began to stay more frequently at the Abbey of Holyrood , about a mile from the castle . Around the end of the fifteenth century , King James IV ( r . 1488 – 1513 ) built Holyroodhouse , by the abbey , as his principal Edinburgh residence , and the castle ' s role as a royal home subsequently declined . James IV did , however , construct the Great Hall , which was completed in the early 16th century . 16th century and the Lang Siege . James IV was killed in battle at Flodden Field , on 9 September 1513 . Expecting the English to press their advantage , the Scots hastily constructed a town wall around Edinburgh and augmented the castle ' s defences . Robert Borthwick and a Frenchman , Antoine d ' Arces , were involved in designing new artillery defences and fortifications in 1514 , though it appears from lack of evidence that little of the planned work was carried out . Three years later , King James V ( r . 1513 – 1542 ) , still only five years old , was brought to the castle for safety . Upon his death 25 years later , the crown passed to his week - old daughter , Mary , Queen of Scots . English invasions followed , as King Henry VIII attempted to force a dynastic marriage on Scotland , although Edinburgh Castle remained largely unaffected . Following these campaigns , refortifications included an earthen angle - bastion , known as the Spur , of the type known as " trace italienne " , one of the earliest examples in Britain . It may have been designed by Migiliorino Ubaldini , an Italian engineer from the court of Henry II of France , and was said to have the arms of France carved on it . James V ' s widow , Mary of Guise , acted as regent from 1554 until her death at the castle in 1560 . The following year , the Catholic Mary , Queen of Scots , returned from France to begin her reign , which was marred by crises and quarrels amongst the powerful Protestant Scottish nobility . In 1565 , the Queen made an unpopular marriage with Henry Stuart , Lord Darnley , and the following year , in a small room of the Palace at Edinburgh Castle , she gave birth to their son James , who would later be King of both Scotland and England . Mary ' s reign was , however , brought to an abrupt end . Three months after the murder of Darnley at Kirk o ' Field in 1567 , she married James Hepburn , 4th Earl of Bothwell , one of the chief murder suspects . A large proportion of the nobility rebelled , resulting ultimately in the imprisonment and forced abdication of Mary at Loch Leven Castle . She escaped and fled to England , but some of the nobility remained faithful to her cause . Edinburgh Castle was initially handed by its Captain , James Balfour , to the Regent Moray , who had forced Mary ' s abdication and now held power in the name of the infant King James VI . Shortly after the Battle of Langside , in May 1568 , Moray appointed Sir William Kirkcaldy of Grange Keeper of the Castle . Grange was a trusted lieutenant of the Regent , but after Moray ' s murder in January 1570 his allegiance to the King ' s cause began to waver . Intermittent civil war continued between the supporters of the two monarchs , and in April 1571 Dumbarton Castle fell to " the King ' s men " . Under the influence of William Maitland of Lethington , Mary ' s secretary , Grange changed sides , occupying the town and castle of Edinburgh for Queen Mary , and against the new regent , the Earl of Lennox . The stand - off which followed was not resolved until two years later , and became known as the " Lang Siege " , from the Scots word for " long " . Hostilities began in May , with a month - long siege of the town , and a second short siege in October . Blockades and skirmishing continued meanwhile , and Grange continued to refortify the castle . The King ' s party appealed to Elizabeth I of England for assistance , as they lacked the artillery and money required to reduce the castle , and feared that Grange would receive aid from France . Elizabeth sent ambassadors to negotiate , and in July 1572 a truce was agreed and the blockade lifted . The town was effectively surrendered to the King ' s party , with Grange confined to the castle . The truce expired on 1 January 1573 , and Grange began bombarding the town . His supplies of powder and shot , however , were running low , and despite having 40 cannon available , there were only seven gunners in the garrison . The King ' s forces , now with the Earl of Morton in charge as regent , were making headway with plans for a siege . Trenches were dug to surround the castle , and St Margaret ' s Well was poisoned . By February , all Queen Mary ' s other supporters had surrendered to the Regent , but Grange resolved to resist despite water shortages within the castle . The garrison continued to bombard the town , killing a number of citizens . They also made sorties to set fires , burning 100 houses in the town and then firing on anyone attempting to put out the flames . In April , a force of around 1 , 000 English troops , led by Sir William Drury , arrived in Edinburgh . They were followed by 27 cannon from Berwick - upon - Tweed , including one that had been cast within Edinburgh Castle and captured by the English at Flodden . The English troops built an artillery emplacement on Castle Hill , immediately facing the east walls of the castle , and five others to the north , west and south . By 17 May these batteries were ready , and the bombardment began . Over the next 12 days the gunners dispatched around 3 , 000 shots at the castle . On 22 May , the south wall of David ' s Tower collapsed , and the next day the Constable ' s Tower also fell . The debris blocked the castle entrance , as well as the Fore Well , although this had already run dry . On 26 May , the English attacked and captured the Spur , the outer fortification of the castle , which had been isolated by the collapse . The following day Grange emerged from the castle by a ladder after calling for a ceasefire to allow negotiations for a surrender to take place . When it was made clear that he would not be allowed to go free even if he ended the siege , Grange resolved to continue the resistance , but the garrison threatened to mutiny . He therefore arranged for Drury and his men to enter the castle on 28 May , preferring to surrender to the English rather than the Regent Morton . Edinburgh Castle was handed over to George Douglas of Parkhead , the Regent ' s brother , and the garrison were allowed to go free . In contrast , Kirkcaldy of Grange , his brother James and two jewellers , James Mossman and James Cokke , who had been minting coins in Mary ' s name inside the castle , were hanged at the Cross in Edinburgh on 3 August . Nova Scotia and Civil War . Much of the castle was subsequently rebuilt by Regent Morton , including the Spur , the new Half Moon Battery and the Portcullis Gate . Some of these works were supervised by William MacDowall , the master of work who fifteen years earlier had repaired David ' s Tower . The Half Moon Battery , while impressive in size , is considered by historians to have been an ineffective and outdated artillery fortification . This may have been due to a shortage of resources , although the battery ' s position obscuring the ancient David ' s Tower and enhancing the prominence of the palace block , has been seen as a significant decision . The battered palace block remained unused , particularly after James VI departed to become King of England in 1603 . James had repairs carried out in 1584 , and in 1615 – 1616 more extensive repairs were carried out in preparation for his return visit to Scotland . The mason William Wallace and master of works James Murray introduced an early Scottish example of the double - pile block . The principal external features were the three , three - storey oriel window s on the east façade , facing the town and emphasising that this was a palace rather than just a place of defence . During his visit in 1617 , James held court in the refurbished palace block , but still preferred to sleep at Holyrood . In 1621 , King James granted Sir William Alexander the land in North America between New England and Newfoundland , as " Nova Scotia " ( " New Scotland " ) . To promote the settlement and plantation of the new territory , the Baronetage of Nova Scotia was created in 1624 . Under Scots Law , baronets had to " take sasine " by symbolically receiving the earth and stone of the land of which they were baronet . To make this possible , since Nova Scotia was so distant , the King declared that sasine could be taken either in the new province or alternatively " at the castle of Edinburgh as the most eminent and principal place of Scotland . " James ' successor , King Charles I , visited Edinburgh Castle only once , hosting a feast in the Great Hall and staying the night before his Scottish coronation in 1633 . This was the last occasion that a reigning monarch resided in the castle . In 1639 , in response to Charles ' attempts to impose Episcopacy on the Scottish Church , civil war broke out between the King ' s forces and the Presbyterian Covenanter s . The Covenanters , led by Alexander Leslie , captured Edinburgh Castle after a short siege , although it was restored to Charles after the Peace of Berwick in June the same year . The peace was short - lived , however , and the following year the Covenanters took the castle again , this time after a three - month siege , during which the garrison ran out of supplies . The Spur was badly damaged , and was demolished in the 1640s . The Royalist commander James Graham , 1st Marquis of Montrose was imprisoned here after his capture in 1650 . In May 1650 , the Covenanters signed the Treaty of Breda , allying themselves with the exiled Charles II against the English Parliamentarians , who had executed his father the previous year . In response to the Scots proclaiming Charles King , Oliver Cromwell launched an invasion of Scotland , defeating the Covenanter army at Dunbar in September . Edinburgh Castle was taken after a three - month siege , which caused further damage . The Governor of the Castle , Colonel Walter Dundas , surrendered to Cromwell despite having enough supplies to hold out , allegedly from a desire to change sides . Garrison fortress : Jacobites and prisoners of war . After his Restoration in 1660 , Charles II opted to maintain a full - time standing army based on Cromwell ' s New Model Army . From this time until 1923 , a garrison was continuously maintained at the castle . The medieval royal castle was transformed into a garrison fortress , but continued to see military and political action . The Marquis of Argyll was imprisoned here in 1661 , when King Charles II settled old scores with his enemies following his return to the throne . Twenty years later , Argyll ' s son , the 9th Earl of Argyll , was also imprisoned in the castle for religious Nonconformism in the reign of King James VII . He escaped by disguising himself as his sister ' s footman , but was recaptured and returned to the castle after his failed rebellion to oust James from the throne in 1685 . James VII was deposed and exiled by the Glorious Revolution of 1688 , which installed William of Orange as King of England . Not long after , in early 1689 , the Estates of Scotland , after convening to accept William formally as their new king , demanded that Duke of Gordon , Governor of the Castle , surrender the fortress . Gordon , who had been appointed by James VII as a fellow Catholic , refused . In March 1689 , the castle was blockaded by 7 , 000 troops against a garrison of 160 men , further weakened by religious disputes . On 18 March , Viscount Dundee , intent on raising a rebellion in the Highlands , climbed up the western side of the Castle Rock to urge Gordon to hold the castle against the new King . Gordon agreed , but during the ensuing siege he refused to fire upon the town , while the besiegers inflicted little damage on the castle . Despite Dundee ' s initial successes in the north , Gordon eventually surrendered on 14 June , due to dwindling supplies and having lost 70 men during the three - month siege . Under the terms of the Acts of Union , which joined England and Scotland in 1707 , Edinburgh was one of the four Scottish castles to be maintained and permanently garrisoned by the new British Army , the others being Stirling , Dumbarton and Blackness . The castle was almost taken in the first Jacobite rising in support of James Stuart , the " Old Pretender " , in 1715 . On 8 September , just two days after the rising began , a party of around 100 Jacobite Highlanders , led by Lord Drummond , attempted to scale the walls with the assistance of members of the garrison . However , the rope ladder lowered by the castle sentries was too short , and the alarm was raised after a change of the watch . The Jacobites fled , while the deserters within the castle were hanged or flogged . In 1728 , General Wade reported that the castle ' s defences were decayed and inadequate , and a major strengthening of the defences was carried out throughout the 1720s and 1730s . This was the period when most of the artillery defences and bastion s on the north and west sides of the castle were built . These were designed by military engineer Captain John Romer , and built by the architect William Adam . They include the Argyle Battery , Mills Mount Battery , the Low Defences and the Western Defences . The last military action at the castle took place during the second Jacobite rising of 1745 . The Jacobite army , under Charles Edward Stuart ( " Bonnie Prince Charlie " ) , captured Edinburgh without a fight in September 1745 , but the castle remained in the hands of its ageing Deputy Governor , General George Preston , who refused to surrender . After their victory over the government army at Prestonpans on 21 September , the Jacobites attempted to blockade the castle . Preston ' s response was to bombard Jacobite positions within the town . After several buildings had been demolished and four people killed , Charles called off the blockade . The Jacobites themselves had no heavy guns with which to respond , and by November they had marched into England , leaving Edinburgh to the castle garrison . Over the next century , the castle vaults were used to hold prisoners of war during several conflicts , including the Seven Years ' War ( 1756 – 1763 ) , the American War of Independence ( 1775 – 1783 ) and the Napoleonic Wars ( 1803 – 1815 ) . During this time , several new buildings were erected within the castle , including powder magazines , stores , the Governor ' s House ( 1742 ) , and the New Barracks ( 1796 – 1799 ) . 19th century to the present . A mass prison break in 1811 , in which 49 prisoners of war escaped via a hole in the south wall , persuaded the authorities that the castle vaults were no longer suitable as a prison . This use ceased in 1814 and the castle began gradually to assume a different role as a national monument . In 1818 , Sir Walter Scott was given permission to search the castle for the Crown of Scotland , believed lost after the union of Scotland and England in 1707 . Breaking into a sealed room , now known as the Crown Room , and unlocking a chest within , he rediscovered the Honours of Scotland , which were then put on public display with an entry charge of one shilling . In 1822 , King George IV made a visit to Edinburgh , becoming the first reigning monarch to visit the castle since Charles II in 1651 . In 1829 , the cannon Mons Meg was returned from the Tower of London , where it had been taken as part of the process of disarming Scotland after " the ' 45 " , and the palace began to be opened up to visitors during the 1830s . St Margaret ' s Chapel was " rediscovered " in 1845 , having been used as a store for many years . Works in the 1880s , funded by the Edinburgh publisher William Nelson and carried out by Hippolyte Blanc , saw the Argyle Tower built over the Portcullis Gate and the Great Hall restored after years of use as a barracks . A new Gatehouse was built in 1888 . During the 19th century , several schemes were put forward for rebuilding the whole castle as a Scottish Baronial style " château " . Work began in 1858 , but was soon abandoned , and only the hospital building was eventually remodelled in 1897 . Following the death of Prince Albert in 1861 , the architect David Bryce put forward a proposal for a keep as a memorial , but Queen Victoria objected and the scheme was not pursued . In 1905 , responsibility for the castle was transferred from the War Office to the Office of Works , although the garrison remained until 1923 , when the troops moved to Redford Barracks in south - west Edinburgh . The castle was again used as a prison during the First World War , when " Red Clydeside r " David Kirkwood was confined in the military prison block , and during the Second World War , when downed German " Luftwaffe " pilots were captured . The position of Governor of Edinburgh Castle , vacant since 1876 , was revived in 1935 as an honorary title for the General Officer Commanding in Scotland , the first holder being Lieutenant - General Sir Archibald Cameron of Lochiel . The castle passed into the care of Historic Scotland when it was established in 1991 , and was designated a Scheduled Ancient Monument in 1993 . The buildings and structures of the castle are further protected by 24 separate listings , including 13 at category A , the highest level of protection for a historic building in Scotland . The Old and New Towns of Edinburgh , a World Heritage Site inscribed by UNESCO in 1995 , is described as " dominated by a medieval fortress " . Description . Edinburgh Castle is located at the top of the Royal Mile , at the west end of Edinburgh ' s Old Town . The volcanic Castle Rock offers a naturally defended position , with sheer cliffs to north and south , and a steep ascent from the west . The only easy approach is from the town to the east , and the castle ' s defences are situated accordingly , with a series of gates protecting the route to the summit of the Castle Rock . Outer defences . In front of the castle is a long sloping forecourt known as the Esplanade . Originally the Spur , a 16th - century hornwork , was located here . The present Esplanade was laid out as a parade ground in 1753 , and extended in 1845 . It is upon this Esplanade that the Edinburgh Military Tattoo takes place annually . From the Esplanade the Half Moon Battery is prominent , with the Royal Palace to its left . The Gatehouse at the head of the Esplanade was built as an architecturally cosmetic addition to the castle in 1888 . Statues of Robert the Bruce by Thomas Clapperton and William Wallace by Alexander Carrick were added in 1929 , and the Latin motto " Nemo me impune lacessit " is inscribed above the gate . The dry ditch in front of the entrance was completed in its present form in 1742 . Within the Gatehouse are offices , and to the north is the most recent addition to the castle ; the ticket office , completed in 2008 to a design by Gareth Hoskins Architects . The road , built by James III in 1464 for the transport of cannon , leads upward and around to the north of the Half Moon Battery and the Forewall Battery , to the Portcullis Gate . In 1990 , an alternative access was opened by digging a tunnel from the north of the esplanade to the north - west part of the castle , separating visitor traffic from service traffic . Portcullis Gate and Argyle Tower . The Portcullis Gate was begun by the Regent Morton after the Lang Siege of 1571 – 73 to replace the round Constable ' s Tower , which was destroyed in the siege . In 1584 the upper parts of the Gatehouse were completed by William Schaw , and these were further modified in 1750 . In 1886 – 1887 this plain building was replaced with a Scots Baronial tower , designed by the architect Hippolyte Blanc , although the original Portcullis Gate remains below . The new structure was named the Argyle Tower , from the fact that the 9th Earl of Argyll had been held here prior to his execution in 1685 . Described as " restoration in an extreme form " , the rebuilding of the Argyle Tower was the first in a series of works funded by the publisher William Nelson . Just inside the gate is the Argyle Battery overlooking Princes Street , with Mills Mount Battery , the location of the One O ' Clock Gun , to the west . Below these is the Low Defence , while at the base of the rock is the ruined Wellhouse Tower , built in 1362 to guard St . Margaret ' s Well . This natural spring provided an important secondary source of water for the castle , the water being lifted up by a crane mounted on a platform known as the Crane Bastion . Military buildings . The areas to the north and west of the Argyle Tower are largely occupied by military buildings erected after the castle became a major garrison in the early 18th century . Adjacent to Mills Mount are the 18th - century cart sheds , now tea rooms . The Governor ' s House to the south was built in 1742 as accommodation for the Governor , Storekeeper , and Master Gunner , and was used until the post of Governor became vacant in the later 19th century ; it was then used by nurses of the castle hospital . Today , it functions as an officers ' mess , and as the office of the Governor since the restoration of the post in 1936 . South of the Governor ' s House are the New Barracks , completed in 1799 to house 600 soldiers , and replacing the outdated accommodation in the Great Hall . They now house the Regimental Headquarters of the Royal Regiment of Scotland and the Regimental Headquarters and Museum of the Royal Scots Dragoon Guards ( Carabiniers and Greys ) . The latter was opened in 1995 by the regiment ' s Colonel , Queen Elizabeth II . Also nearby , in the former Royal Scots drill hall , constructed in 1900 , is the regimental museum of the Royal Scots ( The Royal Regiment ) . The military prison was built in 1842 as a detention block for the castle garrison and was extended in the 1880s . It was last used in 1923 , when the garrison moved to the city ' s Redford Barracks . National War Museum of Scotland . West of the Governor ' s House , a store for munitions was built in 1747 – 48 and later extended to form a courtyard , in which the main gunpowder magazine also stood . In 1897 the area was remodelled as a military hospital , formerly housed in the Great Hall . The building to the south of this courtyard is now the National War Museum of Scotland , which forms part of the National Museums of Scotland . It was formerly known as the Scottish United Services Museum , and , prior to this , the Scottish Naval and Military Museum , when it was located in the Queen Anne Building . It covers Scotland ' s military history over the past 400 years , and includes a wide range of military artefacts , such as uniforms , medals and weapons . The exhibits also illustrate the history and causes behind the many wars in which Scottish soldiers have been involved . Beside the museum is Butts Battery , named after the archery butts ( targets ) formerly placed here . Below it are the Western Defences , where a postern , named the West Sally Port , gives access to the western slope of the rock . Upper Ward . The Upper Ward or Citadel occupies the highest part of the Castle Rock , and is entered via the late 17th - century Foog ' s Gate . The origin of this name is unknown , although it was formerly known as the Foggy Gate , which may relate to the dense sea - fogs , known as haars , which commonly affect Edinburgh . Adjacent to the gates are the large cisterns built to reduce the castle ' s dependency on well water and a former fire station , now used as a shop . The summit of the rock is occupied by St Margaret ' s Chapel and 15th - century siege gun Mons Meg . On a ledge below this area is a small 19th - century Dogs ' Cemetery for the burial of the soldiers ' regimental mascot s . Beside this , the Lang Stair leads down to the Argyle Battery , past a section of a medieval bastion , and gives access to the upper storey of the Argyle Tower . The eastern end of the Upper Ward is occupied by the Forewall and Half Moon Batteries , with Crown Square to the south . St . Margaret ' s Chapel . The oldest building in the castle , and in Edinburgh , is the small St . Margaret ' s Chapel . One of the few 12th - century structures surviving in any Scottish castle , it dates from the reign of King David I ( r . 1124 – 1153 ) , who built it as a private chapel for the royal family and dedicated it to his mother , Saint Margaret of Scotland , who died in the castle in 1093 . It survived the slighting of 1314 , when the castle ' s defences were destroyed on the orders of Robert the Bruce , and was used as a gunpowder store from the 16th century , when the present roof was built . In 1845 , it was " discovered " by the antiquary Daniel Wilson , while in use as part of the larger garrison chapel , and was restored in 1851 – 1852 . The chapel is still used for religious ceremonies , such as weddings . Mons Meg . The 15th - century siege gun or bombard known as Mons Meg is displayed on a terrace in front of St . Margaret ' s Chapel . She was constructed in Flanders on the orders of Philip III , Duke of Burgundy in 1449 , and gifted by him to the husband of his niece , King James II , in 1457 . The gun rests on a reconstructed carriage , the details of which were copied from an old stone relief that can be seen inside the tunnel of the Gatehouse at the castle entrance . Some of Meg ' s large gun stones , weighing around each , are displayed alongside her . On 3 July 1558 , she was fired in salute to celebrate the marriage of Mary , Queen of Scots to the French dauphin , François II . The royal Treasurer ' s Accounts of the time record a payment to soldiers for retrieving one of her stones from Wardie Muir near the River Forth , fully from the castle . The gun has been defunct since her barrel burst while firing a salute to greet the Duke of Albany , the future King James VII and II , on his arrival in Edinburgh on 30 October 1681 . Half Moon Battery and David ' s Tower . The Half Moon Battery , which remains a prominent feature on the east side of the castle , was built as part of the reconstruction works supervised by the Regent Morton , and was erected between 1573 and 1588 . The Forewall to the north was built between 1689 and 1695 to link the Half Moon to the Portcullis Tower , although part of the original wall of 1540 was incorporated into it . The Half Moon Battery was built around and over the ruins of David ' s Tower , two storeys of which survive beneath , with windows facing out onto the interior wall of the battery . David ' s Tower was built on an L - plan , the main block being , with a wing measuring to the west . The entrance was via a pointed - arched doorway in the inner angle , although in the 16th century this was filled in to make the tower a solid rectangle . Prior to the Lang Siege , the tower was recorded as being high , and the remaining portions stand up to from the rock . The tower was rediscovered during routine maintenance work in 1912 , and excavations below the Half Moon Battery revealed the extent of the surviving buildings . Several rooms are accessible to the public , although the lower parts are generally closed . Outside the tower , but within the battery , is a three - storey room , where large portions of the exterior wall of the tower are still visible , showing shattered masonry caused by the bombardment of 1573 . Beside the tower , a section of the former curtain wall was discovered , with a gun loop which overlooked the High Street : a recess was made in the outer battery wall to reveal this gun loop . Also in 1912 – 1913 , the adjacent Fore Well was cleared and surveyed , and was found to be deep , and mostly hewn through the rock below the castle . Crown Square . Crown Square , also known as Palace Yard , was laid out in the 15th century , during the reign of King James III , as the principal courtyard of the castle . The foundations were formed by the construction of a series of large stone vaults built onto the uneven Castle Rock in the 1430s . These vaults were used as a state prison until the 19th century , although more important prisoners were held in the main parts of the castle . The square is formed by the Royal Palace to the east , the Great Hall to the south , the Queen Anne Building to the west , and the National War Memorial to the north . Royal Palace . The Royal Palace comprises the former royal apartments , which were the residence of the later Stewart monarchs . It was begun in the mid 15th century , during the reign of James IV , and it originally communicated with David ' s Tower . The building was extensively remodelled for the visit of James VI to the castle in 1617 , when state apartment s for the King and Queen were built . On the ground floor is the Laich ( low ) Hall , now called the King ' s Dining Room , and a small room , known as the Birth Chamber or Mary Room , where James VI was born to Mary , Queen of Scots , in June 1566 . The commemorative painted ceiling and other decoration were added in 1617 . On the first floor is the vaulted Crown Room , built in 1615 to house the Honours of Scotland : the crown , the sceptre and the sword of state . The Stone of Scone , upon which the monarchs of Scotland were traditionally crowned , has been kept in the Crown Room since its return to Scotland in 1996 . To the south of the palace is the Register House , built in the 1540s to accommodate state archives . Great Hall . The Great Hall measures , and was the chief place of state assembly in the castle , although there is no evidence that the Parliament of Scotland ever met here , as is sometimes reported . Historians have disagreed over its dating , although it is usually ascribed to the reign of King James IV , and is thought to have been completed in the early years of the 16th century . The decorative carved stone corbel s supporting the roof have Renaissance detailing , which has been compared to works at Blois , France , of around 1515 , indicating that the arts in Scotland were relatively advanced at this time . It is one of only two medieval halls in Scotland with an original hammerbeam roof . Following Oliver Cromwell ' s seizure of the castle in 1650 , the Great Hall was converted into a barracks for his troops ; and in 1737 it was subdivided into three storeys to house 312 soldiers . Following the construction of the New Barracks in the 1790s , it became a military hospital until 1897 . It was then restored by Hippolyte Blanc in line with contemporary ideas of medieval architecture . The Great Hall is still occasionally used for ceremonial occasions , and has been used as a venue on Hogmanay for BBC Scotland ' s " Hogmanay Live " programme . To the south of the hall is a section of curtain wall from the 14th century with a parapet of later date . Queen Anne Building . In the 16th century , this area housed the kitchens serving the adjacent Great Hall , and was later the site of the Royal Gunhouse . The present building was named after Queen Anne and was built during the attempted Jacobite invasion by the Old Pretender in 1708 . It was designed by Captain Theodore Dury , military engineer for Scotland , who also designed Dury ' s Battery , named in his honour , on the south side of the castle in 1713 . The Queen Anne Building provided accommodation for Staff Officer s , but after the departure of the Army it was remodelled in the 1920s as the Naval and Military Museum , to complement the newly opened Scottish National War Memorial . The museum later moved to the former hospital in the western part of the castle , and the building now houses a function suite and an education centre . Scottish National War Memorial . The Scottish National War Memorial occupies a converted barrack block on the north side of Crown Square . It stands on the site of the medieval St . Mary ' s Church which was rebuilt in 1366 , and was converted into an armoury in 1540 . It was demolished in 1755 , and the masonry reused to build a new North Barrack Block on the site . Proposals for a Scottish National War Memorial were put forward in 1917 , during the First World War , and the architect Sir Robert Lorimer was appointed in 1919 . Construction began in 1923 , and the memorial was formally opened on 14 July 1927 by the Prince of Wales . The exterior is decorated with gargoyle s and sculpture , while the interior contains monuments to individual regiments . The stained - glass windows are by Douglas Strachan . The memorial commemorates Scottish soldiers , and those serving with Scottish regiment s , who died in the two world wars and in more recent conflicts . Upon the altar within the Shrine , placed upon the highest point of the Castle Rock , is a sealed casket containing Rolls of Honour which list over 147 , 000 names of those soldiers killed in the First World War . After the Second World War , another 50 , 000 names were inscribed on Rolls of Honour held within the Hall , and further names continue to be added there . The memorial is maintained by a charitable trust . Present use . Edinburgh Castle is in the ownership of the Scottish Ministers as heads of the devolved Scottish Government . The castle is run and administered , for the most part , by Historic Scotland , an executive agency of the Scottish Government , although the Army remains responsible for some areas , including the New Barracks block and the military museums . Both Historic Scotland and the Army share use of the Guardroom immediately inside the castle entrance . Tourist attraction . Historic Scotland undertakes the dual tasks of operating the castle as a commercially viable tourist attraction , while simultaneously bearing responsibility for conservation of the site . Edinburgh Castle remains the most popular paid visitor attraction in Scotland , with over 1 . 2 million visitors in 2011 . Historic Scotland maintains a number of facilities within the castle , including two cafés / restaurants , several shops , and numerous historical displays . An educational centre in the Queen Anne Building runs events for schools and educational groups , and employs re - enactors in costume and with period weaponry . Military role . Direct administration of the castle by the War Office came to an end in 1905 , and in 1923 the Army formally moved to the city ' s new Redford Barracks . Nevertheless , the castle continues to have a strong connection with the Army , and is one of the few ancient castles in Britain that still has a military garrison , albeit for largely ceremonial and administrative purposes . Public duties performed by the garrison include guarding the Honours of Scotland , and armed sentries stand watch at the Gatehouse outside opening hours . The post of Governor of Edinburgh Castle is now a ceremonial post , held by the General Officer Commanding Scotland . The New Barracks contain both the Governor ' s House , which serves as the Officers ' Mess , and the Regimental Headquarters of the Royal Regiment of Scotland . The Army retains responsibility for these and for the Royal Scots Museum and Royal Scots Dragoon Guards Museum . Military Tattoo . A series of performances known as the Edinburgh Military Tattoo takes place on the Esplanade each year during August . The basis of each performance is a parade of the massed pipes and drums of the Scottish regiments , and since its inception in 1950 the Tattoo has developed a complex format which includes a variety of performers invited from around the world , although still with a largely military focus . The climax of the evening is the lone piper on the castle battlements , playing a pibroch in memory of dead comrades - in - arms , followed by massed bands joining in a medley of traditional Scottish tunes . The Tattoo attracts an annual audience of around 217 , 000 people , and is broadcast in some 30 countries to a television audience estimated at 100 million . One O ' Clock Gun . The One O ' Clock Gun is a time signal , fired every day at precisely 13 : 00 , excepting Sunday , Good Friday and Christmas Day . The ' Time Gun ' was established in 1861 as a time signal for ships in the harbour of Leith and the Firth of Forth , away . It complemented the ' Time Ball ' , which was installed on the Nelson Monument in 1852 , but was useless as a visual signal in foggy weather . Because sound travels relatively slowly ( approximately ) , a map was produced in 1861 to show the actual time when the sound of the gun would be heard at various locations across Edinburgh . The original gun was an 18 - pound muzzle - loading cannon , which needed four men to load , and was fired from the Half Moon Battery . This was replaced in 1913 by a 32 - pound breech - loader , and in May 1952 by a 25 - pound Howitzer . The present One O ' Clock Gun is an L118 Light Gun , brought into service on 30 November 2001 . The gun is now fired from Mill ' s Mount Battery , on the north face of the castle , by the District Gunner from the 105th Regiment Royal Artillery ( Volunteers ) . Although the gun is no longer required for its original purpose , the ceremony has become a popular tourist attraction . The longest - serving District Gunner , Staff Sergeant Thomas McKay MBE , nicknamed " Tam the Gun " , fired the One O ' Clock Gun from 1979 until his retirement in January 2005 . McKay helped establish the One O ' Clock Gun Association , which opened a small exhibition at Mill ' s Mount , and published a book entitled " What Time Does Edinburgh ' s One O ' clock Gun Fire ? " . In 2006 Sergeant Jamie Shannon , nicknamed " Shannon the Cannon " , became the 29th District Gunner , and in 2013 Bombardier Allison Jones became the first woman to fire the gun . Symbol of Edinburgh . The castle has become a recognisable symbol of Edinburgh , and of Scotland . It appears , in stylised form , on the coats of arms of the City of Edinburgh and the University of Edinburgh . During the Second World War it featured on the badge of No . 603 ( City of Edinburgh ) Squadron based at RAF Turnhouse ( now Edinburgh Airport ) . Images of the castle are used as a logo by organisations including Edinburgh Rugby , the " Edinburgh Evening News " , Hibernian F . C . and the Edinburgh Marathon . It also appears on the " Castle series " of Royal Mail postage stamps , and has been represented on various issues of banknotes issued by Scottish clearing banks . In the 1960s the castle was illustrated on £5 notes issued by the National Commercial Bank of Scotland , and since 1987 it has featured on the reverse of £1 notes issued by the Royal Bank of Scotland . Since 2009 the castle , as part of Edinburgh ' s World Heritage Site , has appeared on £10 notes issued by the Clydesdale Bank . The castle is a focal point for annual fireworks displays which mark Edinburgh ' s Hogmanay ( new year ) celebrations , and the end of the Edinburgh Festival in the summer .