Boris Johnson is heading for prison if he breaks the law and defies parliament by still pursuing a no-deal Brexit, says a former top prosecutor.

The prime minister will be in “contempt of court” and will face the same punishment as any other citizen, Lord MacDonald, the former director of public prosecutions, warned.

He said a court would order that “the law should be followed” if, as expected, parliament passes legislation on Monday to force Mr Johnson to seek an extension to Article 50 and avert a crash-out on 31 October.

“A refusal in the face of that would amount to contempt of court which could find that person in prison,” Lord MacDonald said.

It would not be an “extreme outcome” as it is “convention” that anyone who refuses to “purge their contempt” is sent to prison, he said.

Protesters take to streets after Boris Johnson suspends parliament Show all 11 1 /11 Protesters take to streets after Boris Johnson suspends parliament Protesters take to streets after Boris Johnson suspends parliament Anti Brexit protesters march on Whitehall EPA Protesters take to streets after Boris Johnson suspends parliament Many of the protesters carried placards AP Protesters take to streets after Boris Johnson suspends parliament A demonstrator wears a Boris Johnson mask during a London rally AFP/Getty Images Protesters take to streets after Boris Johnson suspends parliament An anti-Brexit demonstrator wields an EU flag during a London rally. AFP/Getty Images Protesters take to streets after Boris Johnson suspends parliament The protesters also marched to Trafalgar Square, where they blocked traffic AP Protesters take to streets after Boris Johnson suspends parliament John McDonnell addressed crowds in Whitehall. PA Protesters take to streets after Boris Johnson suspends parliament A small group of Brexit supporters attempted to stage a counter protest in central London. AP Protesters take to streets after Boris Johnson suspends parliament Three people were arrested in London, including a woman who sat on the road near Trafalgar Square. AP Protesters take to streets after Boris Johnson suspends parliament In Oxford, locals and students gathered outside Balliol College, Boris Johnson's alma mater, to protest. PA Protesters take to streets after Boris Johnson suspends parliament Thousands of people gather in central Glasgow to protest against the prime minister. AFP/Getty Images Protesters take to streets after Boris Johnson suspends parliament Jeremy Corbyn spoke to protesters in central Glasgow. Getty

However, the cross-bench peer said, it was also possible that a court could order another figure in government to sign the letter asking the EU for the delay.

The warning comes after Mr Johnson vowed to lie “dead in a ditch” before asking Brussels for the extension and said the law about to be passed would only force him to request the delay “in theory”.

David Lidington, the former de facto deputy prime minister, has suggested the prime minister would be helping the rise of strong-arm, populist leaders, who would seize on events in the UK to make the case for their abuses of democracy.

Meanwhile, MPs fighting a no-deal Brexit are lining up a legal team to prepare to go to court to compel Mr Johnson to comply.

Lord Sumption, a former Supreme Court judge also speaking to Sky News, agreed there would be “plenty of ways” to enforce the law.

MPs opposed to no deal could apply for an injunction ordering Mr Johnson to authorise a delay, after which – if he refused to comply – a judge could order an official to sign off the extension “in place of the prime minister”.

However, the author and historian argued it was unlikely to get to that point, as senior civil servants would refuse to cooperate with a prime minister who was wilfully breaking the law.

“He won’t get any cooperation, apart from the fanatics around him… the attorney general won’t sit there quietly while this happens,” Lord Sumption said.

“If he was to do something as foolish as that, he would be on his own, maybe accompanied by Dominic Cummings,” he argued.

The controversy was fuelled as groups of pro- and anti-Brexit protesters clashed on Parliament Square.

About 200 people joined a pro-Brexit demonstration organised by the Democratic Football Lads Alliance (DFLA) outside the Houses of Parliament.

When members of the anti-Brexit group March for Change began to set up for a rally of their own, some members of the DFLA approached and began shouting.