29 Legislative competence.U.K.
(1)An Act of the Scottish Parliament is not law so far as any provision of the Act is outside the legislative competence of the Parliament.
(2)A provision is outside that competence so far as any of the following paragraphs apply—
(a)it would form part of the law of a country or territory other than Scotland, or confer or remove functions exercisable otherwise than in or as regards Scotland,
(b)it relates to reserved matters,
(c)it is in breach of the restrictions in Schedule 4,
(d)it is incompatible with any of the Convention rights or with Community law,
(e)it would remove the Lord Advocate from his position as head of the systems of criminal prosecution and investigation of deaths in Scotland.
(3)For the purposes of this section, the question whether a provision of an Act of the Scottish Parliament relates to a reserved matter is to be determined, subject to subsection (4), by reference to the purpose of the provision, having regard (among other things) to its effect in all the circumstances.
(4)A provision which—
(a)would otherwise not relate to reserved matters, but
(b)makes modifications of Scots private law, or Scots criminal law, as it applies to reserved matters,
is to be treated as relating to reserved matters unless the purpose of the provision is to make the law in question apply consistently to reserved matters and otherwise.