An essential part of any tour of St Andrews is a visit to the ruin of its once mighty castle. This site was fortified by the 1100s, and from around 1200 it was adopted as the main residence of the bishops and archbishops of St Andrews.
As such, the castle became the principal administrative centre of the Scottish church and was the setting for some of the key events in Scottish history. Little of this early castle can be traced through the existing ruins. Almost nothing remains of the earliest structure which suffered badly during the Wars of Independence and was finally rendered indefensible by the Scots in 1337 to avoid it being held again by the English.
Completed in about 1400, the "new" castle was the work of Bishop Trail. With steep cliffs protecting it to the north and east and thick curtain walls and rock cut ditches on its landward side, it was built to be easily defended.
The structure of the castle included five square towers providing residence for the bishop, his large household and guests. Ranges were built along the inside of each length of curtain wall and further accommodation was provided in outer courtyards to the south and west of the main castle.
As a residence, St Andrews Castle saw many notable visitors, including the young James I who visited in 1410. The castle also served as a strong and grim prison. An especially striking remnant of this role is the bottle dungeon, a bottle shaped pit dug 22ft down into the rock below the Sea Tower and accessible only via the narrow neck opening through a trap door from the floor of tower vault. Into this prisoners could simply be lowered, or dropped, and forgotten.
Further significant work on the castle was undertaken by Archbishop James Beaton following the Battle of Flodden in 1513. This was designed to allow the structure to withstand an attack by heavy artillery. Two massive circular gun towers, called blockhouses, were built on the landward side and heavy carriage-mounted guns were positioned at the wall tops.
Beaton appointed as his successor his nephew David Beaton, an ambitious man who later became a Cardinal and a prominent figure in both the religious and political life of Scotland: despite being in all but name married to Marion Ogilvy. It was Cardinal Beaton's strong opposition to the marriage of the infant Mary, Queen of Scots to Prince Edward, son and heir of Henry VIII of England, that led to renewed warfare between the two countries in 1544.
Not satisfied with this, in March 1546, he had the Protestant preacher, George Wishart, burnt at the stake in front of the castle walls. This was subsequently used as a pretext for Beaton's grisly murder at the hands of local Protestant lairds who captured the castle by stealth.
A long siege followed on the orders of the Regent, the Earl of Arran. By November 1546 this had resulted in a stalemate and the attackers resorted to an approach that has left what is today St Andrews Castle's second most chilling underground artefact after the bottle dungeon: the mine.
The besiegers sought to undermine the walls of the castle by digging a spacious tunnel large enough to take pack animals who were used to carry out the spoil. The defenders responded to the mine by trying to dig an intercepting tunnel or countermine. After several false starts the defenders' low, narrow, twisting countermine broke through into the attackers' mine, resulting in underground fighting between the two sides. Today's visitors are able to make their way down the countermine and into the mine, though it's not somewhere for those with claustrophobia or an overly active imagination.
The siege was eventually settled, decisively, in 1547 with the arrival of a French fleet which reduced the castle to ruins (see our Historical Timeline). Amongst those captured when the castle fell was John Knox.
St Andrews Castle passed next to the illegitimate brother of the Regent Earl of Arran, Archbishop John Hamilton. Although finally hanged after he was implicated in the death of Lord Darnley, he was able to rebuild most of the castle. The result was a much more grand and elaborate structure than the fortress it replaced.
The Reformation of the Scottish Church in 1560 had little immediate effect on the castle and its operation, but over time it became increasingly neglected. Its association with the church seemed permanently severed in 1606 when it passed to the Earl of Dunbar, but it did later return to church control before finally falling into ruin after the ascendancy of William and Mary in 1689.
To the modern visitor, St Andrews Castle shows the scars of the centuries of decay since its abandonment. But it is still possible to get a sense of grandeur here and view the unusual features that have survived. There is also a very good visitors' centre offering an excellent exhibition.