Question: Which monarch was imprisoned in Scotland?

Context articles: Sheriff principal
Dieu et mon droit
Marian civil war
Royal Arms of Scotland
Lord of Galloway
Loch Leven Castle
Lieutenancy areas of Scotland
Royal coat of arms of the United Kingdom
High Court of Constabulary
Crown Estate Scotland (Interim Management)

In Scotland a sheriff principal ("pl".
 sheriffs principal) is a judge in charge of a sheriffdom with judicial, quasi-judicial, and administrative responsibilities.
 Sheriffs principal have been part of the judiciary of Scotland since the 11th century.
 Sheriffs principal were originally appointed by the Monarch of Scotland, and evolved into a heritable jurisdiction before appointment was again vested in the Crown and the Monarch of the United Kingdom following the passage of the Heritable Jurisdictions (Scotland) Act 1746.
Dieu et mon droit (] ), meaning "God and my right", is the motto of the Monarch of the United Kingdom outside Scotland.
 It appears on a scroll beneath the shield of the version of the coat of arms of the United Kingdom used outside Scotland.
 The motto is said to have first been used by Richard I (1157–1199) as a battle cry and presumed to be a reference to his French ancestry and the divine right of the Monarch to govern.
 It was adopted as the royal motto of England by King Henry V (1386–1422) with the phrase "and my right" referring to his claim to the French crown as a descendant of the French who conquered England under William the Conqueror.
The Marian civil war in Scotland (1568–1573) was a period of conflict which followed the abdication of Mary, Queen of Scots, and her escape from Loch Leven Castle in May 1568.
 Those who ruled in the name of her infant son James VI fought against the supporters of the Queen, who was exiled in England.
 Edinburgh Castle, which was garrisoned in her name, became the focus of the conflict and surrendered only after an English intervention in May 1573.
 The conflict in 1570 was called an "intestine war in the bowels of this commonwealth", and the period was called soon after an "intestine war driven by questions against authority."
The royal arms of Scotland was the official coat of arms of the King of Scots first adopted in the 12th century.
 With the Union of the Crowns in 1603, James VI inherited the thrones of England and Ireland and thus his arms in Scotland were now quartered with the arms of England (which was itself quartered with France) with an additional quarter for Ireland also added (the arms would continue to alter in later years).
 Though the kingdoms of England and Scotland would share the same monarch, the distinction in heraldry used in both kingdoms was maintained.
 When the kingdoms of Scotland and England were united under the Acts of Union 1707 to form the United Kingdom of Great Britain, no single arms were created and instead, the royal arms as used in either Scotland and the rest of the United Kingdom would continue to differ.
The lords of Galloway consisted of a dynasty of heirs who were lords (or kings) and ladies who ruled over Galloway in southwest Scotland, mainly during the High Middle Ages.
 Many regions of Scotland, including Galloway and Moray, periodically had kings or subkings, similar to those in Ireland during the Middle Ages.
 The Scottish monarch was seen as being similar to a high king ("Ard-Righ" in Gaelic).
 The lords of Galloway would have either paid tribute to the Scottish monarch, or at other times ignored him.
 The Lords of Galloway are fairly well recorded in the 12th and 13th centuries, but the records are incomplete or conflicting at other times.
 Later on, the kings were known as "lords" at the Scottish court, and "kings" at home, finally becoming "lords" in both arenas.
Loch Leven Castle is a ruined castle on an island in Loch Leven, in the Perth and Kinross local authority area of Scotland.
 Possibly built around 1300, the castle was the location of military action during the Wars of Scottish Independence (1296–1357).
 In the latter part of the 14th century, the castle was granted by his uncle to William Douglas, 1st Earl of Douglas, and remained in Douglas' hands for the next 300 years.
 Mary, Queen of Scots was imprisoned here in 1567–1568, and forced to abdicate as queen, before escaping with the help of her gaoler's family.
 In 1588, the Queen's gaoler inherited the title Earl of Morton, and moved away from the castle.
 It was bought, in 1675, by Sir William Bruce, who used the castle as a focal point in his garden; it was never again used as a residence.
The lieutenancy areas of Scotland (Scots: "Lieutenancy auries o Scotland" ) are the areas used for the ceremonial lord-lieutenants, the monarch's representatives, in Scotland.
 The lord-lieutenants' titles chosen by the monarch and her legal advisers are mainly based on placenames of the traditional counties of Scotland.
 In 1794 permanent lieutenancies were established by Royal Warrant.
 By the Militia Act 1797 (37 Geo.3, C.103), the lieutenants appointed "for the Counties, Stewartries, Cities, and Places" were given powers to raise and command County Militia Units.
The royal coat of arms of the United Kingdom, or the Royal Arms for short, is the official coat of arms of the British monarch, currently Queen Elizabeth II.
 These arms are used by the Queen in her official capacity as monarch of the United Kingdom.
 Variants of the Royal Arms are used by other members of the British royal family; and by the British government in connection with the administration and government of the country.
 In Scotland, there exists a separate version of the Royal Arms, a variant of which is used by the Scotland Office.
 The arms in banner form serve as basis for the monarch's official flag, known as the "Royal Standard".
The High Court of Constabulary was a court in Scotland presided over by the Lord High Constable of Scotland and other judges known as Constables-depute.
 The court had exclusive jurisdiction over crimes of rioting, disorder, bloodshed, and murder that took place within 4 miles of the Monarch of Scotland, Privy Council of Scotland, or the Parliament of Scotland.
 It was established in the 13th century, and its "de jure" jurisdiction continued until at least the 19th century.
 From the 16th century the Constables-depute appear to have been the Lord Provosts, bailies, and Sheriffs of Edinburgh.
 Following the Treaty of Union of 1707, the Court had jurisdiction when the Monarch of Great Britain, and later the Monarch of the United Kingdom, was resident at the Palace of Holyrood House.
Crown Estate Scotland (Interim Management) (Scottish Gaelic: "Oighreachd a’ Chrùin Alba (Stiùireadh Eadar-amail)" ) is the public corporation of the Scottish Government responsible for the management of land and property in Scotland owned by the monarch in right of the Crown.
 It is responsible for managing a range of rural, coastal and marine assets and works with the Scottish Government, Scottish Parliament, local authorities, communities and businesses in sectors such as offshore renewables, farming, tourism and aquaculture.
 The assets are held 'in right of the Crown' and the monarch remains the legal owner, but it is not the private property of the monarch.
 It cannot be sold by the monarch, nor do revenues from it belong to the monarch.
 Surplus revenue (i.e. revenue profit) is paid from Crown Estate Scotland (Interim Management) to the Scottish Consolidated Fund.