A UK Government lawyer has told judges the courts would have to "deal with" what happens "in some way" if the Prime Minister breached an order to request a Brexit extension.

Campaigners lodged an appeal at the Court of Session in Edinburgh after the dismissal of a legal action aimed at forcing Boris Johnson to request a Brexit extension if no withdrawal deal is secured with the EU by October 19, under the terms of the so-called Benn Act.

Judge Lord Pentland ruled on Monday it was not necessary to compel the Prime Minister to comply with the terms of the Act given "unequivocal assurances" of Mr Johnson and the government made before the court.

Number 10 has been accused of submitting documents to the court which contradict his public statements, such as the UK will leave the EU "do or die" on October 31.

The latest legal action - led by SNP MP Joanna Cherry, businessman Dale Vince, and Jolyon Maugham QC - is seeking an order requiring the Prime Minister to send the request and also another which would allow an official to do so if not.

This unique tool is known as "nobile officium", however government lawyer David Johnston QC argued the courts do not have the power to use it in these circumstances.

Mr Johnston added: "If the Prime Minister were not to comply with an order, what happens then? I think I would have to accept that the court must be able to deal with that in some way.

"Whether nobile officium is the correct way, I have my reservations about that."

It had been put forward that the court clerk would sign the letter request for the UK, in place of the Prime Minister.

However, Lord President of the Court of Session Lord Carloway said: "If we were granting an order, it wouldn't be the court clerk. The responsibility might have to be at a higher level."

He added: "That's no offence to the court clerk."

Aidan O'Neill QC, representing the petitioners, claimed the author of that signature could perhaps be the Speaker of the House of Commons.

He also repeated claims that the Conservative Party leader could not be trusted to abide by the law due to his past statements.

Mr O'Neill said: "One shouldn't be taken in by any kind of shtick that the Prime Minister is an overgrown schoolboy playing at Just William and his band of outlaws.

"What I say to this court is, 'When they go low, the rule of law goes high'.

"What we have in this application is an application to the effect should the government not comply with its duties, then this court, in order to preserve the rule of law, must itself authorise an individual to sign the letter and make the necessary declarations.

"It is an unprecedented step, but these are unprecedented times."

Andrew Webster QC, also representing the government, argued any interference from the courts could hamper the UK's negotiations with the EU.

He claimed its position on Brexit - that it wants to leave with or without a deal on October 31 - does not mean it will not comply with the terms of the Act.

The court heard the legislation leaves room for a no-deal withdrawal, as long as parliament agrees to it.

Lord Carloway questioned whether the court's decision could be put off until after the October 19 date outlined in the Act, but Mr Webster claimed this could hamper negotiations.

Speaking after the hearing, Mr Maugham said: "My guess is that they're going to hold the matter over until October 21.

"I think they will want to see what actually happens before they get into this difficult territory. None of us want to have a Prime Minister who's facing contempt of court proceedings.

"But if he doesn't, then we face a genuine constitutional crisis and we will have to pick up the pieces then."

A judgment is expected to be issued on Wednesday.