“THE Prime Minister’s advice to Her Majesty the Queen and the prorogation which followed thereon was unlawful and is thus null and of no effect.” That was the shock verdict of three judges of the Inner House of the Court of Session on Wednesday. For their different reasons, Lords Carloway, Brodie and Drummond Young all concluded that the Prime Minister’s sleekit prorogation for five weeks through October was unlawful.

We don’t have a full judgment yet. That’s going to be published on Friday. But even the judicial summary was stinging. This Court of Session bench wasn’t buying Boris Johnson’s spin, and they weren’t prepared to embrace the old-school, “hands-off” approach of Lord Doherty last week.

Take the case back to first principles. The petitioners argued that Johnson acted unlawfully. They hoped to call him to account in an action for judicial review.

How? It’s long been recognised that prime ministers have the constitutional authority to advise the Queen to prorogue Parliament. Surely Johnson was just exercising this discretion? Up to a point. But the courts have also – for some years – demanded that decision-makers in public life exercise their powers within lawful bounds. That doesn’t mean that anything they do which has a superficial appearance of legality is A-OK. Intention matters.

If a local authority, a planning committee, a minister, or even a prime minister takes a decision on the basis of improper or unconstitutional purposes, the courts can intervene. That isn’t a principle unique to Scots law. It has long been the position of English courts too.

So what was Boris Johnson’s true purpose in proroguing Parliament through October? Was this purpose consistent with Britain’s (admittedly fragmented) constitutional values?

Everyone and their dog – Brexiteer or diehard Remoaner – knows exactly what Number 10 was doing when it decided to bring the parliamentary session to an early close this week.

The official paper trail – produced by the UK Government in the course of the case – only tended to confirm the mendacity of the UK Government’s position.

The papers showed Boris Johnson’s administration denied it had any intention to prorogue Parliament in public, when arrangements to do precisely this were already in train. This was a lie. The idea that Parliament was prorogued because the Tories’ domestic agenda needs the boost of a new Queen’s Speech doesn’t even have the hallmarks of superficial plausibility.

In Edinburgh on Wednesday, three Court of Session judges called out this mendacity and implausibility. For Lord Carloway, the “true purpose” of the prorogation was clearly “to stymie parliamentary scrutiny of the executive, which was a central pillar of the good governance principle enshrined in the constitution”.

READ MORE: The Court of Session's statement on the illegal prorogation of Parliament in full

For Drummond Young, "it was incumbent on the UK Government to show a valid reason for the prorogation”. The circumstances, the judge concluded, showed Johnson’s true purpose was “to prevent” and “restrict” legitimate parliamentary scrutiny of the UK Government behaviour.

READ MORE: Prorogation of Parliament unlawful, Court of Session rules

The sharpest words came from Lord Brodie. For him, “this was an egregious case of a clear failure to comply with generally accepted standards of behaviour of public authorities”. The “principal reasons for the prorogation”, he said, “were to prevent or impede Parliament holding the executive to account and legislating with regard to Brexit”. And who can credibly disagree with him?

This was a surprise outcome. At the outset of this litigation, I thought it stood a snowball’s chance in hell of succeeding – but the odds have evened up as the arguments have been aired and tested, and the dodgy paper trail of the UK Government has been revealed.

READ MORE: Downing Street claims Scottish Cherry case judges biased

The judgment has thrown the UK Government’s spinners and political outriders into a frenzy. Some are attempting to imply that the Court of Session is some kind of hotbed for constitutional radicals. This is not only a slur on the professional integrity of three of Scotland’s most experienced judicial figures – it is a bad joke. The idea that Lords Carloway, Brodie and Drummond Young are woad-painted Nats is for the birds.

READ MORE: Boris Johnson to appeal Scottish Court's Brexit judgment

But the ultimate outcome of this case is no sure thing. The last word on the legality of the Prime Minister’s behaviour will go to the Supreme Court in London. On the 17th of September, the justices will decide whether to side with Lord Carloway and his two colleagues, or with Lord Doherty and the judges of the High Court in England and Wales, who concluded the prorogation was lawful. For the gamblers amongst you, this case may be worth a bet either way.