For the tens of thousands of visitors who throng Edinburgh’s Old Town, it’s the big building at the bottom end of the Royal Mile, the one that isn’t the Scottish Parliament. For the Queen, it’s the Palace of Holyroodhouse, her other royal residence in Scotland besides Balmoral. For the locals, it’s just Holyrood, once the site of a 12th century Augustinian abbey, now a crenelated tourist attraction with a rather nifty gallery attached.

This picture shows the gates and gate-piers at the west end of the forecourt, part of the memorial to King Edward VII. Holyrood Abbey is just visible behind and straight ahead are the royal apartments once occupied by the ill-starred Mary I. It was here that she witnessed the murder of her Italian favourite David Rizzio, stabbed to death on March 9, 1566, by a group led by Mary’ jealous husband, Lord Darnley.

That’s one of the most famous stories associated with Holyrood Palace, but there are plenty of others. How Bonnie Prince Charlie spent five weeks holding court here in the autumn of 1745 while preparing to invade England. How the Duke of Cumberland moved in a few months later on his way to Culloden. How Louis XVI’s youngest brother, the future Charles X of France, spent seven years there and used a handy quirk of the law to evade his creditors: debtors could find sanctuary within the old abbey grounds. A copper ‘S’ in the ground at the corner of Horse Wynd and Abbey Strand is a reminder of it, though in fact the right of sanctuary at Holyrood has never been repealed. (Imprisonment for debt has, of course).

The palace has been periodically besieged, attacked, bombed, looted and ransacked – by anti-Catholic Edinburgh mobs among other actors. But though it has suffered entire eras of neglect it has always been rebuilt, restored and reconstructed eventually. All except the abbey church, whose roof collapsed in 1768 and was never replaced. The palace as we know it today is largely the version built in the late 17th century, though the oldest surviving elements are the additions made by James V in the 1530s to the older building which was already there. By the mid-19th century it was an established tourist destination and George V dragged it into the 20th century with the addition of electric lighting and central heating.

For the record, Lord Darnley was dead himself less than a year after Rizzio’s murder, blown out of his bed by two barrels of gunpowder placed in the room directly under it. Three months after that, in the Great Hall at Holyrood Palace, Mary married Lord Bothwell, the man many suspected of commissioning the deed.