Boris Johnson would trigger a legal and constitutional crisis that would force his resignation as prime minister if he failed to obey a law mandating him to seek another extension to Brexit, according to high-level legal advice obtained by Labour.

The conclusions of a team of leading QCs, which have been sent to the shadow Brexit secretary, Keir Starmer, make clear that the prime minister would be declared in contempt of court if he tried to remain in No 10 while refusing to obey legislation to prevent the UK leaving the EU without a deal on 31 October. The new law is expected to gain royal assent from the Queen early next week.

Play Video 1:07 Jeremy Corbyn warns Boris Johnson he is not above the law – video

The legal advice, from lawyers at Matrix Chambers, says: “If the prime minister refused to comply with this order, then, while we would be in historically uncharted political territory, the legal position would remain clear – the prime minister would be in contempt of an order of the court and would be exposed to a full range of sanctions.”

One of the QCs who provided the unequivocal advice, Philippe Sands, told the Observer: “If the prime minister chooses not to comply with EU (Withdrawal) No 6 Act, he will be subject to an action for contempt which could, logically and as a matter of last resort, lead to imprisonment, but that has never happened and will not happen; Britain is a rule of law country, so he will comply or leave office. All other talk is bluster, as attorney general Geoffrey Cox will already have advised him.”

But Lord Macdonald, the former director of public prosecutions, warned Johnson that he could end up in prison. “It is convention that if you are found guilty of defying a court order, then you are jailed,” he said.

On Saturday, as violence over Brexit broke out near parliament, Downing Street said Johnson remained defiant and would neither resign, nor comply with the law to delay Brexit.

Play Video 0:42 Pro-Brexit supporters clash with police at London's Parliament Square - video

Drawn up by a cross-party group of MPs vehemently against a no-deal outcome, the legislation mandates the prime minister to seek a further extension to Brexit beyond the current date of 31 October to 31 January next year – unless Johnson has either secured a deal with the EU that is acceptable to parliament, or MPs have voted for no deal before 19 October.

Johnson and his advisers are this weekend exploring further legislative possibilities, including the “nuclear” option of tabling a no-confidence motion in the government and ordering Tory MPs to vote for it, in order to trigger an election. Such a motion would require only a simple majority of MPs to pass, but may not be allowed by the Speaker, John Bercow.

Anti-Brexit protesters decry Johnson's 'coup' in cities across UK Read more

Downing Street sources also said No 10 was examining ways of pushing the EU into expelling the UK by refusing to nominate a new British commissioner. No 10 advisers believe this would mean the European Commission would not be legally constituted as from 1 November.

But Jean-Claude Piris, a former head of the EU council legal service, said Britain’s lack of a commissioner would not pose a major problem. “The commission will be legally able to function and take legal decisions with a member less,” he said.

The crisis engulfing Johnson and his government, which saw the prime minister’s brother Jo resign from the cabinet on Thursday after 21 Tory MPs were stripped of the whip, deepened further last night when the most senior MP, Kenneth Clarke, said he was thinking about voting for the Liberal Democrats at the next election and regarded a Jeremy Corbyn government as less damaging to the UK than a no-deal Brexit.

In his first newspaper interview since being stripped of the whip after almost 60 years in the Conservative party, the father of the house told the Observer that if he were starting out on his political career now, he would not choose the Tories. “If I was 20 years old and thinking which political party I was going to join … I would not join the Conservative party. I would not follow Boris Johnson in this wild, rightwing nationalist stuff,” he said.

Tories extend lead over Labour to 10% despite chaotic week Read more

Asked if he would vote Conservative at the next election, Clarke said he had not decided, but could choose the Lib Dems: “If I was going to cast a protest vote, I would follow the Conservative tradition of voting Lib Dem.” Both a no-deal Brexit and a Corbyn government were “awful prospects”, but “a no-deal Brexit could cause far more damage to our future economic success than a Corbyn government”.

Sources within government said Johnson’s senior aide, Dominic Cummings, told fellow advisers on Friday that last week’s purge of rebel MPs such as Clarke was “only the beginning” of a ruthless strategy to push Brexit through. It is understood he told advisers: “By the time we get to the end of this, [those opposing Johnson’s plans] are going to melt.”

The legal advice obtained by Labour warns that if Johnson defies the law, the civil service will be placed in an “invidious position in so far as they may be asked to take steps that are either contrary to the law or seek improperly to circumvent the law”.

Starmer said: “If the government does anything other than follow the letter of the law, then this political crisis will very quickly also become a legal one. And that is a path I warn ministers not to take.”

It is parliament’s duty to resist Johnson’s dangerous no-deal Brexit strategy | Dominic Grieve Read more

Writing in the Observer, former Tory attorney general Dominic Grieve, who helped draw up the new law, said: “Unless a new withdrawal agreement materialises at the EU summit ending on 18 October, the government must apply for the extension the next day.

“If necessary, a court order can be applied for to require the prime minister to do so. At that point, if he refused he would be in contempt of court and could be sent to prison.”

Meanwhile police, including officers on horseback, clashed with anti-Brexit protesters in Parliament Square in Westminster.

About 200 people joined a pro-Brexit demonstration organised by the Democratic Football Lads Alliance, while the anti-Brexit group March for Change held its own protest.