British Prime Minister Boris Johnson will comply with the Supreme Court's ruling if it concludes his advice to the Queen to suspend Parliament for five weeks was unlawful, the court has heard.
Giving a legal undertaking on behalf of Mr Johnson, the Advocate General for Scotland, Lord Keen QC, said the Prime Minister will "take the necessary steps".
However, he refused to rule out the possibility Mr Johnson may advise the Queen to prorogue Parliament for a second time.
Lord Keen made the comments 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 that 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."
He 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 QC, 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 concluded that the length of the prorogation was "purely political" and not a matter for the courts.
Earlier today, Mrs Miller's barrister said the case raises "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."
He also said it was a "remarkable feature" of the proceedings that Mr Johnson has not provided a statement explaining why he advised Britain's Queen Elizabeth to suspend Parliament for the "exceptionally long period".
Lord Pannick argued that the High Court "erred in law" in the case of Mrs Miller and that the Inner House of the Court of Session reached the "correct" conclusion as to Mr Johnson's motive for proroguing Parliament.
Former prime minister Sir John Major, shadow attorney general Baroness Chakrabarti and the Scottish and Welsh governments - who supported Ms Miller's High Court challenge - are all interveners in the Supreme Court case.
Victims' campaigner Raymond McCord - who brought separate proceedings in Belfast, arguing that a no-deal Brexit would damage the Northern Ireland peace process - is also an intervener.
Prorogation is the end of a parliamentary session brought about other than by the dissolution of parliament before a general election.
Mr Johnson advised Queen Elizabeth on 28 August to prorogue Parliament for five weeks and it was suspended on 9 September.
Mr Jonhson says the suspension is to allow the government to set out a new legislative agenda in a Queen's Speech when MPs return to Parliament on 14 October.
But those challenging his decision argue that it is designed to prevent parliamentary scrutiny of the UK's impending exit from the EU on 31 October.
Meanwhile a barrister for 'Good Law Project' has said that the consequences of the courts not upholding the Scottish ruling and not getting involved in the running of parliament are "really stark".
Speaking to RTÉ News, Jolyon Maugham said: "The government says that it can suspend parliament against parliament's will with whatever motive for as long as it wants, and no one can do anything about it.
"If that proposition is right, there is nothing left of parliamentary democracy. That is not a political statement, that is a statement that goes right to the heart of the constitution as we understand it."
We need your consent to load this rte-player contentWe use rte-player to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences
The Supreme Court justices are being asked to determine whether the Prime Minister's advice to the Queen is "justiciable" - capable of challenge in the courts - and, if so, whether it was lawful.
The court will hear further submissions from the parties and the interveners tomorrow and Thursday, but it is not clear when a ruling will be given.
A crowd of about 40 protesters, holding signs saying "Defend democracy", "Reopen Parliament" and "They misled the Queen", remained outside the Supreme Court throughout the hearing.
A smaller number of pro-Brexit demonstrators, including one who shouted "traitor" at Mrs Miller as she left court, also gathered outside the historic building on Parliament Square.
Ahead of the hearing, Mrs Miller - who previously brought a successful legal challenge over the triggering of the Article 50 process to start the Brexit countdown - described the prorogation decision as "a classic power-grab".
Ms Cherry said she was "cautiously optimistic" the Supreme Court would uphold the Scottish ruling.
Lawyers for the Prime Minister will outline his case that his advice on the suspension was lawful from 10.30am tomorrow.