IN this latest part of my series on Scotland’s built heritage I am going to be looking at an important royal residence and its part in Scottish history.

Last week I dealt with three palaces that were very much involved in historical events, namely Scone with its links to the ancient kings of Scotland; and Falkland and Linlithgow, the latter two built and developed as royal homes mostly by the Stewart dynasty.

One reader emailed me to say: “Ah, but you’ve missed out the most important royal palace of them all, Holyroodhouse.”

That was deliberate because I want to devote today’s column to that most elegant of buildings, though as we shall see, it was not always in the pink of condition.

Some people prefer to call it Holyrood or Holyrood Palace but its official designation is the Palace of Holyroodhouse and I am not going to argue the nomenclature with King Charles III, whose royal residence in Scotland it is.

Holyroodhouse has been at the centre of Scotland’s royal history for centuries, with its most famous resident being probably Mary, Queen of Scots, in the 1560s.

There’s no question that Holyroodhouse has played host to some of the most important events in Scottish royal history, and does so even today, as witnessed during the funeral of the Queen and the presentation of the Honours of Scotland to our new King.

Those who termed that event his Scottish coronation do not have the appreciation of royal history that Charles has, for there has been no separate Scottish kingdom since 1707 and he was well aware of the political implications of having coronations in both London and Edinburgh.

READ MORE: Peer says AI with 'lower running costs' could replace House of Lords

The Palace of Holyroodhouse dates back to the early 12th century when the site was chosen by King David I to be the location of a new abbey that he founded after a legendary escape from death. I say legendary for much the same story of a royal encounter with a stag can be found on the continent, as in the early life of St Eustace.

Historic Environment Scotland now cares for the ruined abbey and states on its website: “Legend has it that David I was hunting in the royal forest of Drumsheugh when he was thrown from his horse below Salisbury Crags. He was speared in the thigh by the antlers of a ‘muckle white hart [stag]’.

“Had it not been for the ‘holy rood’ [crucifix that miraculously appeared in the King’s hands as he grappled with the animal, he would surely have died. In thanks to God, David endowed a ‘monastery of the Holy Rood’ close to where he escaped death.”

David was the son of King Malcolm Canmore and his queen, St Margaret, who is said to have possessed a fragment of the cross of Christ, known as the Black or Holy Rood. Making a shrine for the country’s most important relic could have been another reason why David had the abbey built for the Augustinian order of monks around 1128.

It was King David, one of Scotland’s greatest monarchs, who moved the capital to Edinburgh from Dunfermline and although Edinburgh Castle was the seat of government, David I made Holyrood Abbey his home, staying in chambers created for him.

Over the next two centuries the abbey was at the centre of government, hosting parliaments, diplomatic meetings and royal ceremonies. It was at Holyrood Abbey in 1328 that King Robert the Bruce signed the Treaty of Edinburgh-Northampton which guaranteed Scottish independence – an agreement with England that lasted five years until Edward III of England broke it.

Interestingly, the actual place of the Bruce’s signature is given as the “King’s Chamber”, suggesting it was already used as a royal residence, though we know that for the latter part of his life he stayed in his west-coast mansion in the lands of Lennox, probably over the Carman Hills from Cardross at Renton in the Vale of Leven – a royal residence that has been lost for centuries.

READ MORE: Lords' power grab on Scotland 'must be fought tooth and nail'

Royal lodgings were built in the grounds of the abbey and these played host to the families of several Scottish monarchs, some of whom were buried in the abbey’s chapel.

The first main development of the Palace of Holyroodhouse was down to King James IV following his betrothal to English princess Margaret Tudor, sister of King Henry VIII. Their 1503 marriage took place in the abbey, with the new palace completed some years later. It was in Gothic style, and had a Great Hall where banquets and meetings of the Scottish Parliament could take place.

It was firmly the family home when James IV led the charge of the Scottish army at the Battle of Flodden Field in 1503 and paid for his foolhardiness with his life.

Queen Margaret became regent for her son, James V, and continued to rule from the palace until James took up his personal reign and greatly expanded Holyroodhouse, including building of James V’s Tower which is the oldest part of the palace still in existence.

Interestingly, the design of the tower showed James V meant his palace to be defensible like a castle, uniquely among the royal palaces.

James V’s daughter was Mary, Queen of Scots, and she is the monarch most associated with Holyroodhouse.

Mary’s mother, Marie de Guise, acted as regent during Mary’s childhood and she brought French culture to bear on Holyroodhouse which she refurbished it after the English army vandalised Edinburgh and the palace during the so-called War of the Rough Wooing of 1544 and 1547.

When Mary returned from France to take up her personal reign of Scotland in 1560, the Reformation was already under way and the palace was centre stage during that turbulent era of Scotland’s history.

READ MORE: Nigel Farage receives apology from BBC over reporting of banking row

Mary made Holyroodhouse her home and the centre of her government, bringing in French women as her main servants. She even had a real tennis court, the location of which remains unknown.

In her private chambers she conducted discussions with John Knox, the leader of the Reformation, and the many warring nobles who wanted power at that time.

It was in the palace that she met and married, quite disastrously, her second husband Henry Stuart, Lord Darnley. They married in her private chapel at Holyroodhouse because it was a Catholic service and the vast majority of the Scottish people disapproved.

Indeed at various times during Mary’s reign, demonstrations took place outside Holyroodhouse against her Catholic liturgical services.

The worst day of her time in Holyroodhouse came when rebellious nobles, led or certainly encouraged by Darnley, broke into the Queen’s apartments on the evening of March 9, 1566, and hideously murdered her Italian secretary, David Rizzio or Riccio, who was stabbed to death even as he called on the Queen to save him.

Mary was convinced she or her unborn child were the assassins’ real targets, but her pregnancy continued and for safety she moved to Edinburgh Castle, where she gave birth to the future King James VI and I on June 19, 1566.

Darnley was himself murdered in February 1567 by another faction of the nobility probably led by Mary’s third husband James Hepburn, 4th Earl of Bothwell. Darnley was found asphyxiated after a massive explosion at Kirk o’ Field, a lodging just a few hundred yards from Holyroodhouse.

MARY had conveniently absented herself from the palace and she married the chief suspect in her husband’s murder at Holyroodhouse just three months after Darnley’s death, following a brief affair during which Bothwell may have raped her.

READ MORE: Jackie Baillie left red-faced by Labour's National Policy Forum fall-out

When the Protestant lords and their allies rose against Mary and Bothwell, she left Holyroodhouse never to return and eventually went to her exile and death in England.

In the subsequent civil war between Mary’s supporters and the lords who called themselves the King’s Men, Holyroodhouse was attacked with cannon and some damage was done.

It was repaired by James VI when he took possession of the palace where he lived with his wife Anne of Denmark until the Union of the Crowns in 1603, after which he only returned to Scotland once, in 1617.

The Palace of Holyroodhouse began to fall into a state of neglect, although it was refurbished for the visits of Charles I and Charles II and continued to be a meeting place for the Scottish Parliament until 1630.

The palace and adjacent ruined abbey suffered greatly during the occupation by the troops of Oliver Cromwell’s New Model Army in 1650. Fires broke out and the buildings were almost ruined, with the abbey all but destroyed.

As Lord High Commissioner, John Maitland, 1st Duke of Lauderdale, supervised the rebuilding of the palace in the 1670s and the designs of Sir William Bruce are roughly what we see today.

He gave the palace its symmetrical tower design and the courtyard, as well as sorting the apartments and galleries, much of which survive.

As Duke of York, James VII and II lived for two years at Holyroodhouse and he later built a Jesuit chapel adjacent to the palace and ruined abbey. The Edinburgh Mob razed the chapel when James lost his throne to William and Mary.

After the Union of 1707, Holyroodhouse entered a period as a ghost palace until 1745 and the triumphant entrance of Prince Charles Edward Stuart into the capital, with the prince naming it his seat of government and using the Great Gallery to host balls for the aristocracy.

For a period of six weeks in September and October 1745, Holyroodhouse was the administrative and royal centre of Scotland. It was here that the Bonnie Prince declared the end of the Union but that was more wishful thinking than reality.

When he retreated north from Derby, Bonnie Prince Charlie was being tracked by the troops of Butcher Cumberland. The Duke briefly stayed at the palace but his troops badly damaged it and it seemed as though Holyroodhouse’s days were numbered.

The Dukes of Hamilton had been made hereditary keepers of the palace, and one duke hit on a way of raising funds by allowing visitors to pay a sizeable sum to gain access to the apartments of Mary, Queen of Scots. In effect the royal tourist trade was invented at Holyroodhouse.

The royal connection continued in the 18th and 19th centuries when King George III assigned the palace to the Comte d’Artois, the exiled younger brother of King Louis XVI of France, who later became King Charles X. He stayed at the palace from 1796 to 1803 and had fond memories of his time in Edinburgh, so much so that after the July Revolution of 1830 he and his Bourbon relatives came back to the palace before moving to Prague.

Holyroodhouse was nevertheless deteriorating and when King George IV made his famous visit to Scotland in 1822, he stayed at Dalkeith Palace instead. He did hold receptions and a ball at Holyroodhouse and he ordered that it be refurbished.

Queen Victoria and Prince Albert had the various state and private apartments refurbished during her long reign, but it wasn’t until the reign of King George V that Holyroodhouse was modernised with electric lighting and a lift.

He also designated the palace as the official residence of the monarch in Scotland and so it has remained with King Charles continuing the tradition of the Royal Week when he moves to Holyroodhouse in the summer.

As the events of the last year have shown, the Palace of Holyroodhouse will retain a central role in Scotland’s royal connections, as long as they last.