Image copyright Getty Images Image caption Lawyers for the government insisted Mr Johnson would comply with the law

A Scottish judge has dismissed a move to force Boris Johnson to comply with a law aimed at avoiding a no-deal Brexit.

Campaigners had wanted to ensure that the prime minister would write to the EU to request an extension if no deal is in place by 19 October.

They argued that statements made by the government showed that it could not be trusted.

But Lord Pentland said there could be "no doubt" that the prime minister had agreed to abide by the law.

As a result, he said there was no need for "coercive orders" against the UK government or against the prime minister.

And he said it would be "destructive of one of the core principles of constitutional propriety and of the mutual trust that is the bedrock of the relationship between the court and the Crown" if Mr Johnson reneged on his assurances to the court.

What was the case about?

Image copyright PA Media Image caption Jo Maugham QC said there would be an appeal against the decision

The Scottish legal action was initiated by businessman Dale Vince, QC Jo Maugham and SNP MP Joanna Cherry.

They wanted the Court of Session, Scotland's highest court, to rule on the extent to which Mr Johnson was bound by the so-called Benn Act.

The legislation was passed by MPs with the intention of preventing the UK leaving the European Union without a deal on 31 October.

It requires the prime minister to send a letter to the EU formally requesting an extension to the Brexit timetable if no deal is signed off by Parliament by 19 October - unless MPs agree to a no-deal Brexit.

The petitioners had argued that a series of public statements by the prime minster indicated that he was planning to break the law by refusing to ask for an extension.

Mr Johnson has said he would rather be "dead in a ditch" than ask for a delay.

However, government papers submitted to the court said that Mr Johnson would send a letter to the EU if a deal was not agreed by the deadline.

What did the court decide?

Image copyright Getty Images Image caption The legislation would compel Mr Johnson to write to the EU if there is not a deal

In his ruling, Lord Pentland said the UK government had accepted it must "comply fully" with the act and would not seek to "frustrate its purpose".

As a result, he said there was "no proper basis" on which the court could decide that the government would fail to deliver on that undertaking.

The judge ruled that the UK government's public statements were an expression of its "political policy" and were "clearly not intended to be taken as conclusive statements of the government's understanding of its legal obligations".

Lord Pentland said the prime minister and the government had given "unequivocal assurances" to comply with the 2019 Act.

As a result, he was "not persuaded that it was necessary for the court to grant the orders sought or any variant of them".

What happens next?

Image copyright Getty Images Image caption Campaigners outside the Court of Session in Edinburgh

Those behind the petition said they would appeal against the ruling. It is thought that the appeal could be heard on Tuesday.

Jo Maugham QC said the decision had left Mr Johnson with "wriggle room".

"I very much hope the court is right and that the government will - as the government has promised to do - abide by the law," Mr Maugham said.

"But there is very real doubt in my mind that the government will act in accordance with the law and so tomorrow we will pursue our appeal against the decision of the Outer House to the Inner House of the Court of Session, Scotland's highest court."

Timeline: What's happened with the EU letter case?

4 September - MPs back a bill aimed at blocking a no-deal Brexit on 31 October. The so-called Benn Act says Boris Johnson has until 19 October to either pass a deal in Parliament or get MPs to approve a no-deal Brexit.

4 October - The Court of Session in Edinburgh starts to hear a case from Remain supporters who want a legal guarantee that if there is no deal on Brexit Mr Johnson will write a letter to the EU requesting an extension to the deadline.

4 October - During that hearing papers are lodged at the court saying the prime minister will send the letter to the EU.

7 October - Judge Lord Pentland dismisses the case saying there is "no doubt" that the PM accepts he will comply with the requirements of the act and send the letter in the event of a no deal.

What is the letter Boris Johnson would have to write?

"Dear Mr President,

The UK Parliament has passed the European Union (Withdrawal) (No. 2) Act 2019. Its provisions now require Her Majesty's Government to seek an extension of the period provided under Article 50(3) of the Treaty on European Union, including as applied by Article 106a of the Euratom Treaty, currently due to expire at 11.00pm GMT on 31 October 2019, until 11.00pm GMT on 31 January 2020.

I am writing therefore to inform the European Council that the United Kingdom is seeking a further extension to the period provided under Article 50(3) of the Treaty on European Union, including as applied by Article 106a of the Euratom Treaty. The United Kingdom proposes that this period should end at 11.00pm GMT on 31 January 2020. If the parties are able to ratify before this date, the Government proposes that the period should be terminated early.

Yours sincerely,

Prime Minister of the United Kingdom of Great Britain and Northern Ireland"