quality:correction
Law and order

Scots law has a basis derived from Roman law, combining features of both uncodified civil law, dating back to the Corpus Juris Civilis, and common law with medieval sources. The terms of the Treaty of Union with England in 1707 guaranteed the continued existence of a separate legal system in Scotland from that of England and Wales. Prior to 1611, there were several regional law systems in Scotland, most notably Udal law in Orkney and Shetland, based on old Norse law. Various other systems derived from common Celtic or Brehon laws survived in the Highlands until the 1800s. Scots law provides for three types of courts responsible for the administration of justice: civil, criminal and heraldic. The supreme civil court is the Court of Session, although civil appeals can be taken to the Supreme Court of the United Kingdom (or before 1 October 2009, the House of Lords). The High Court of Justiciary is the supreme criminal court in Scotland. The Court of Session is housed at Parliament House, in Edinburgh, which was the home of the pre-Union Parliament of Scotland with the High Court of Justiciary and the Supreme Court of Appeal currently located at the Lawnmarket. The sheriff court is the main criminal and civil court, hearing most cases. There are 49 sheriff courts throughout the country. District courts were introduced in 1975 for minor offences and small claims. These were gradually replaced by Justice of the Peace Courts from 2008 to 2010.

For three centuries the Scots legal system was unique for being the only national legal system without a parliament. This ended with the advent of the Scottish Parliament in 1999, which legislates for devolved matters. Many features within the system have been preserved. Within criminal law, the Scots legal system is unique in having three possible verdicts: "guilty", "not guilty" and " not proven ". Both "not guilty" and "not proven" result in an acquittal, typically with no possibility of retrial per the rule of double jeopardy. A retrial can hear new evidence at a later date that might have proven conclusive in the earlier trial at first instance, where the person acquitted subsequently admits the offence or where it can be proved that the acquittal was tainted by an attempt to pervert the course of justice. Scots juries, sitting in criminal cases, consist of fifteen jurors, which is three more than is typical in many countries.

The Lord Advocate is the chief legal officer of the Scottish Government and the Crown in Scotland. The Lord Advocate is the head of the systems in Scotland for the investigation and prosecution of crime, the investigation of deaths as well as serving as the principal legal adviser to the Scottish Government and representing the government in legal proceedings. They are the chief public prosecutor for Scotland and all prosecutions on indictment are conducted by the Crown Office and Procurator Fiscal Service in the Lord Advocate's name on behalf of the Monarch. The officeholder is one of the Great Officers of State of Scotland. The current Lord Advocate is Dorothy Bain, who was nominated by First Minister Nicola Sturgeon and appointed in June 2021. The Lord Advocate is supported by the Solicitor General for Scotland.

Since 2013, Scotland has had a unified police force known as Police Scotland. The Scottish Prison Service (SPS) manages the prisons in Scotland, which collectively house over 8,500 prisoners. The Cabinet Secretary for Justice and Home Affairs is responsible for the Scottish Prison Service within the Scottish Government.