SCOTLAND’s Advocate General has given a legal undertaking on behalf of the Prime Minister that he will comply with the Supreme Court ruling should it conclude that his advice to the Queen to suspend Parliament for five weeks was unlawful.

Lord Keen QC told the court yesterday that Boris Johnson will “take the necessary steps”, but he refused to rule out the possibility that Johnson could advise the Queen to prorogue Parliament for a second time.

He made the comments during an exchange with Lord Kerr, one of 11 justices hearing appeals arising from two challenges in Scotland and England over the legality of the prorogation, which resulted in different outcomes.

Kerr asked him what would happen if the court ruled that the prorogation was unlawful, and whether Parliament would be recalled, to which Keen replied: “It will be then for the Prime Minister to address the consequences of that declaration.

“I have given a very clear undertaking that the Prime Minister will respond by all necessary means to any declaration that the ... prorogation was effected by any unlawful advice that he may have given.”

READ MORE: Trials and tribulations, but Robocop’s in town for Supreme Court case

When Kerr asked if it could be taken that the prorogation decision could not be made a second time, Keen replied: “I’m not in a position to comment on that. That will have to be addressed by the decision maker.

“If the court finds it was unlawful, the Prime Minister will take the necessary steps to comply with any declaration made by the court.”

Keen, the chief legal adviser to the UK Government on Scots law, is challenging the ruling of the Inner House of the Court of Session in Edinburgh.

It ruled last week that Johnson’s advice to the Queen was unlawful because it was “motivated by the improper purpose of stymying Parliament”.

Scotland’s most senior judge, Lord Carloway, said in the ruling: “The circumstances demonstrate that the true reason for the prorogation is to reduce the time available for parliamentary scrutiny of Brexit at a time when such scrutiny would appear to be a matter of considerable importance, given the issues at stake.”

The National: SNP MP Joanna Cherry QC said she was 'cautiously optimistic'SNP MP Joanna Cherry QC said she was 'cautiously optimistic'

That ruling was made following an appeal by a group including more than 70 parliamentarians led by SNP MP Joanna Cherry QC, and overturned a previous decision that the suspension was lawful.

Keen said the courts “must not cross the boundaries and intrude upon the business of Parliament”, which would only lose “seven sitting days” because it would have been in recess for party conference season during most of the five weeks. He added: “It is quite plain that the Inner House, in addressing this issue and deciding that it could impugn the decision of the Prime Minister, was proceeding upon a fundamental misconception about how Parliament works.”

The Advocate General’s case is being heard alongside an appeal by campaigner Gina Miller, who is challenging a ruling of the High Court in London which concluded that the length of the prorogation was “purely political” and not a matter for the courts.

Earlier yesterday, her barrister said the case raised “fundamental questions of constitutional law”.

Lord Pannick QC told the judges: “The exceptional length of the prorogation in this case is strong evidence that the Prime Minister’s motive was to silence Parliament for that period because he sees Parliament as an obstacle to the furtherance of his political aims.”

READ MORE: Kevin McKenna: I've obtained the secret Brexit Yellowhammer documents

He also said it was a “remarkable feature” of the proceedings that Johnson had not provided a statement explaining why he advised the Queen to suspend Parliament for the “exceptionally long period”.

Pannick argued that the High Court “erred in law” in Miller’s case and that the Inner House of the Court of Session reached the “correct” conclusion as to Johnson’s motive for proroguing Parliament.

Former PM Sir John Major, shadow attorney general Baroness Chakrabarti and the Scottish and Welsh governments – who supported Miller’s challenge – are all interveners in the Supreme Court case.

Johnson’s official spokesperson said the court case was mentioned by the Prime Minister during yesterday’s cabinet meeting.

“He mentioned the fact that the court case was ongoing and that we are confident in our arguments.”

Asked if Johnson should either give evidence or submit an affidavit to the court, they added: “I am not going to comment on an ongoing court case. The court is the right forum for this to take place.”

Cherry said yesterday she was “cautiously optimistic” that the Scottish court’s decision will be upheld by the Supreme Court.

“I think that Scotland’s supreme court reached the right decision here for the right reasons and I’m cautiously optimistic that at least a majority of the UK Supreme Court justices will follow,” she said.

“If they don’t then they will be accepting that it is possible under the constitution for the prime minister of a minority government to shut down Parliament if it is getting in his way, and that just can’t be right.

“I think the Scottish court’s ruling will prove decisive and persuasive.”