Subsection (1) defines the circumstances in which the section will apply.  It will apply where a court or tribunal decides that an Act of the Scottish Parliament or any provision in such an Act is not within the legislative competence of the Parliament or that a member of the Scottish Executive has purported to make, confirm or approve subordinate legislation when he had no power to do that.
The power itself is defined in subsection (2).  If the court or tribunal makes such a decision, it may make an order to remove or limit any retrospective effect of that decision.  It may also suspend the effect of the decision for any length of time and on any conditions to allow the defect in the Act or the subordinate legislation to be corrected.
Subsection (3) requires the court or tribunal, in deciding whether to make such an order, to have regard (amongst other things) to the extent to which third parties (i.e. those not a party to the proceedings in which the decision is made) would be adversely affected if the power were not exercised.  The court or tribunal may however also take into account other relevant criteria as it sees fit.
Subsection (4) provides that if a court or tribunal is considering using the power conferred by this section it must intimate that to the Lord Advocate and the appropriate law officer (where the decision relates to a devolution issue) if that person is not already a party to the proceedings.  This ensures that, where a Law Officer has already been given intimation that the proceedings raise a devolution issue but he has chosen not to become a party to those proceedings, the Law Officer will be given intimation of the fact that the court intends to make an order under section 102 as it relates to a devolution issue.  “Appropriate law officer” is defined in subsection (7). Rules of court which provide for the giving of notice are S.I. 1999/1345 (Rule of Court 25A.12), S.I. 1999/1346 (Rule 40.12) and S.I. 1999/1347 (Rules 8.9).
Subsection (5) provides that when a person is given intimation in terms of subsection (4) he may participate in the proceedings so far as they relate to the making of the order.
Subsection (6) provides that paragraphs 36 and 37 of Schedule 6 apply, with necessary modifications, for the purposes of subsections (4) and (5) as they apply for the purposes of that Schedule.  This, in effect, enables the courts, in deciding any question of costs or expenses, to take into account the fact that the Lord Advocate has taken part in the proceedings in consequence of this section; and makes clear that general powers to regulate the procedures before any court or tribunal include power to make provisions for the purposes of subsections (4) and (5).
Subsection (7) is a technical provision that defines “intimation” in this section as including notice.  It also provides that the “appropriate law officer” is to be the Advocate General in relation to proceedings in Scotland, the Attorney General in relation to proceedings in England and Wales or the Attorney General for Northern Ireland in relation to proceedings in Northern Ireland.
Commentary Part V: Miscellaneous and General Details of Provisions