Edinburgh Castle, often hailed as one of Scotland’s most iconic landmarks, wasn’t constructed on a single date but evolved over centuries atop an ancient volcanic rock. Its story begins with prehistoric settlements and Iron Age forts, transforming into a royal stronghold by the 12th century under King David I. This enduring fortress has witnessed sieges, kings, and rebirths, making it a cornerstone of Scottish heritage.
Origins in Ancient Geology and Settlement
Castle Rock, the dramatic perch of Edinburgh Castle, formed from a volcanic plug about 350 million years ago during the Carboniferous period. Glacial forces later sculpted this hard dolerite core, creating sheer cliffs that offered natural defenses on three sides, with only the eastern slope approachable. Archaeological digs reveal human activity here dating to the late Bronze Age or early Iron Age, potentially marking Scotland’s longest continuously occupied site, though evidence remains sparse.
By the Iron Age, around the 1st and 2nd centuries CE, a hillfort stood on the summit, flattened artificially as early as 900 BCE. Ptolemy’s 2nd-century map notes a Votadini settlement called “Alauna,” or “rock place,” hinting at Roman-era trade via pottery and brooches found onsite. This fort, known as Din Eidyn, appears in the 7th-century Welsh poem Y Gododdin, describing Gododdin warriors feasting before a doomed battle against Angles. In 638 CE, Northumbrian forces captured it, renaming the site Edinburgh after their conquest.
These prehistoric roots provided the foundation, but no standing structures from this era survive. The rock’s defensibility—rising 130 meters with limited water access—shaped its military destiny, as later wells often failed during sieges.

Emergence as a Medieval Stronghold
The castle enters written history around 1093, when chronicler John of Fordun records Queen Margaret, wife of Malcolm III, dying at the “Castle of Maidens” amid siege by Donald Bane. Though Fordun wrote centuries later, this suggests a timber fort existed by Malcolm’s reign (1058–1093), possibly a wooden keep amid stone elements. Malcolm’s son Edgar died there in 1107, elevating its royal status.
King David I (r. 1124–1153) marks the pivotal shift to stone construction around 1130, building a Norman-style keep and the enduring St. Margaret’s Chapel, Edinburgh’s oldest building. Dedicated to his mother, this tiny chapel likely formed part of a larger fortified complex, akin to Carlisle Castle, which David also developed. David’s “Davidian Revolution” made Edinburgh a power center; he hosted noble assemblies here between 1139 and 1150, precursors to Scotland’s parliament.
By the late 12th century, under William the Lion (r. 1165–1214), the castle housed state papers and surrendered briefly to England’s Henry II in 1174 via the Treaty of Falaise. Returned in 1186 as dowry for William’s bride, it solidified as Scotland’s key repository. These early builds focused on defense and royalty, with timber giving way to stone amid growing Anglo-Scottish tensions.
Wars of Independence and Repeated Reconstructions
The castle’s medieval phase intensified during the Wars of Scottish Independence. Edward I seized it in 1296 after a three-day siege, looting records and treasures while installing builders from his Welsh castles. Thomas Randolph recaptured it in 1314 via a daring night climb, prompting Robert the Bruce to demolish it to deny English reuse.
English forces retook the ruins in 1335, holding until William Douglas’s 1341 merchant ruse slaughtered the garrison. David II (r. 1329–1371) then rebuilt extensively post-1357 Treaty of Berwick, erecting David’s Tower around 1367 as his seat; he died there unfinished in 1371, completed by Robert II. Linked to the Constable’s Tower (1375–1379), this curtain-wall system emphasized artillery amid evolving warfare.
The 15th century saw further turmoil. Henry IV besieged unsuccessfully in 1400, while Keeper William Crichton hosted the infamous 1440 “Black Dinner,” executing young Douglas earls before James II. Crown Square’s vaults emerged in the 1430s, alongside a Great Hall by 1458 and James III’s 1464 access road for cannons. Alexander Stewart escaped David’s Tower in 1479, and James III endured a 1482 siege by his brother Albany and English allies.
Military production boomed: guns from 1384, Mons Meg in 1457, and Robert Borthwick’s foundry by 1511 producing famed cannons like the “Seven Sisters.” James IV (r. 1488–1513) built the extant Great Hall early 16th century, shifting royal focus to Holyrood but fortifying post-Flodden 1513 loss.
The Devastating Lang Siege and 16th-Century Rebirth
Mary, Queen of Scots’s era (1542–1567) brought invasions. Henry VIII’s “Rough Wooing” prompted 1548 refortifications, including the Italianate Spur bastion possibly by Migliorino Ubaldini. Mary of Guise died at the castle in 1560; Mary birthed James VI there in 1566.
Civil war erupted post-Mary’s abdication. Captain William Kirkcaldy of Grange held for her from 1568, sparking the Lang Siege (1571–1573)—the castle’s most destructive. After blockades and town bombardments, English artillery under William Drury fired 3,000 shots in May 1573, collapsing David’s and Constable’s Towers. Grange surrendered to avoid mutiny, hanged later; Regent Morton rebuilt with Half Moon Battery and Portcullis Gate.
James VI repaired the palace block in 1584 and 1615–1616, adding oriel windows for his 1617 visit—his last overnight stay. The castle became Nova Scotia baronetcy’s sasine site in 1624. Charles I’s 1633 coronation feast marked the final royal residence.
17th-Century Sieges and Cromwell’s Grip
Covenanter Wars ravaged it anew. Alexander Leslie seized in 1639, holding through 1640 siege amid Spur demolition. Cromwell captured after Dunbar 1650, with Governor Walter Dundas surrendering despite supplies.
Restoration saw garrisons permanent from 1660, imprisoning foes like Argylls. The 1689 Jacobite siege by Duke of Gordon lasted three months against Williamites, surrendering on supplies. Failed 1715 Jacobite ladder assault and 1745 blockade by Bonnie Prince Charlie—repelled by cannon fire—were last actions.
Vaults held prisoners through Seven Years’, American, and Napoleonic Wars; a 1811 mass escape ended that. 1720s–1730s fortifications by John Romer and William Adam added Argyle and Mills Mount Batteries.

19th-Century Monument and Modern Legacy
Sir Walter Scott rediscovered the Honours of Scotland in 1818, sparking tourism. George IV visited 1822; Mons Meg returned 1829; St. Margaret’s Chapel “rediscovered” 1845. Victorian restorations by Hippolyte Blanc included Argyle Tower (1887) and Great Hall revival.
Military use persisted until 1923 Redford move; WWI/II held prisoners. Historic Scotland (now Historic Environment Scotland) caretakes since 1991; it’s a Scheduled Monument with 24 listings. Over 2.2 million visited pre-2020, backdrop to Military Tattoo.
Today, it houses regalia, War Memorial (1927), museums, and One O’Clock Gun from Mills Mount. Solar panels blend preservation with sustainability.
Enduring Mystery of “When It Was Built”
No single “build date” exists; Iron Age origins evolved under David I’s 1130 stone castle. Sieges destroyed much—26 identified, most besieged in Britain. St. Margaret’s Chapel endures from ~1130, Great Hall from ~1511. This layered history, from volcano to Victorian icon, captivates, embodying Scotland’s resilient spirit.
Who Were the First Known Residents of Edinburgh Castle?
The earliest recorded residents of Edinburgh Castle were Malcolm III of Scotland and his wife Saint Margaret of Scotland in the 11th century. The royal couple used the fortress as a royal residence, and Margaret later died there in 1093, making the castle an important early center of Scottish royal life.
