Giving a legal undertaking on behalf of Mr Johnson, the Advocate General for Scotland, Lord Keen QC, said the Prime Minister would “take the necessary steps”.
However, he refused to rule out the possibility Mr Johnson might advise the Queen to prorogue Parliament for a second time.
Lord Keen made the comments yesterday during an exchange with Lord Kerr, one of 11 justices hearing appeals arising out of two separate challenges in England and Scotland over the legality of the prorogation, which resulted in different outcomes.
When asked by Lord Kerr what would happen if the court rules the prorogation was unlawful, and whether Parliament would be recalled, he replied: “It will be then for the Prime Minister to address the consequences of that declaration.”
Lord Keen added: “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.”
When Lord Kerr asked if it could be taken that the prorogation decision could not be made a second time, Lord Keen replied: “I’m not in a position to comment on that. That will have to be addressed by the decision maker.”
Lord Keen added: “If the court finds it was unlawful, the Prime Minister will take the necessary steps to comply with any declaration made by the court.”
The lawyer, who is the chief legal adviser to the UK government on Scottish law, is challenging the ruling of the Inner House of the Court of Session in Edinburgh.
The court ruled last week that Mr Johnson’s advice to the Queen was unlawful because it was “motivated by the improper purpose of stymying Parliament”.
Lord Carloway, Scotland’s most senior judge, 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.”
That ruling, which was made following an appeal by a group including more than 70 parliamentarians led by SNP MP Joanna Cherry, overturned a previous decision that the suspension was lawful.
Lord Keen said the courts “must not cross the boundaries and intrude upon the business of Parliament”.
He also said the result of the prorogation was that Parliament would only lose “seven sitting days” because it would have been in recess for party conference season throughout most of the five weeks.
Lord Keen 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 found the length of the prorogation was “purely political” and not a matter for the courts.
Earlier yesterday, Mrs Miller’s barrister said the case raised “fundamental questions of constitutional law”.
Lawyers for the PM will outline his case that his advice on the suspension was lawful today.