Few could have predicted how bad things have become for prime minister Boris Johnson, or how quickly. Everything that could go wrong has done so spectacularly – and now, as a professor of law and government, I believe it is time for Johnson to accept he must resign from office immediately.

His government is fighting a losing battle on two fronts. The first is in parliament where he chose to expel some of the most distinguished and popular Tory grandees like Kenneth Clarke and Sir Nicholas Soames for voting against the government on an, admittedly decisive, procedural vote about scheduling parliamentary debates.

Johnson twisted this into a vote of no confidence in him – which it wasn't – and overnight lost his working majority of one. He now leads a do-nothing government, barely able to tie its own shoes.

The second front is being fought in the courts. Today, Jolyon Maugham QC and his Good Law Project won in Scotland's Highest Court. The central issue was Johnson's decision to prorogue, or suspend, parliament for nearly a month. It was claimed to be normal business: a break between one session of parliament and a new legislative session after a Queen's Speech.

However, this normally equates to a matter of days. Three or more weeks are wholly unnecessary. The government says that only an extra few days of Parliament are affected and so the suspension looks much longer than it is. But this isn't quite true either. Many observers expected MPs would want to sit in September, cancelling or curtailing the conference season. The decision to suspend parliament means this option is ruled out.

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

The second, more legally serious, problem is what suspending parliament would do. While MPs and peers have been divided about many matters concerning Brexit, the one issue it has been explicit about and approved by majority votes is its collective opposition to no deal.

But Johnson’s suspension of parliament could easily have had the effect of stopping MPs from giving the weight of law to their widely-held view. Only thanks to the efforts of Hilary Benn and others do we now have a Bill in place which demands that Johnson seek an extension of Article 50 should no-deal loom on 31 October.

If that had not come to pass, then the suspension of parliament by the Queen on the request of her prime minister would, in effect, have changed the law. On such precarious events are new precedents set.

This raises an important constitutional issue which could easily be lost in the relief that the worst outcome was averted. Boris Johnson has now unsettled the convention of the length of proroguing and its purpose. If three weeks are ok, then why not three months – or three years? What would prevent this? And if laws can effectively be changed by blocking parliament from sitting, then we really would be talking about a coup in more than name.

And that is what Scotland's highest court found. They held that the prime minister's intention to suspend parliament was to avoid its scrutiny of his government. In effect, Johnson has been found to have lied to the Queen, to our parliament and the public.

The consequences are profound. In law, the prime minister's request to Her Majesty is ruled unlawful and therefore the Queen's suspension of parliament is null and void. Johnson has had the rug well and truly pulled out from under him and parliament should be reconvened immediately.

A government official has said Downing Street considers parliament to still be prorogued pending a supreme court ruling on the matter, which could come as early as Tuesday. This misunderstands the verdict: the government’s position was found unlawful so to continue to prorogue risks ignoring the courts.

My view is that parliament should return to its previously scheduled sittings until, and unless, this is overruled later. The government cannot legitimately refuse until after the supreme court has had its say. Given the clear unanimous verdict and published evidence, I also believe that the government is very unlikely to overturn the result from the Scottish judges.

Support free-thinking journalism and attend Independent events

Given the court's finding and high likelihood of success on final appeal, it is time that Johnson steps down immediately as prime minister.

He has degraded his position badly enough by making repeated suggestions that his government would not comply with the terms of the Benn Bill. His lawyers should remind him he would risk the serious criminal offence of misconduct in public office that carries a maximum life sentence.

But the main reason for handing the keys to No 10 back to the Queen is that finding today that he misled Her Majesty. In our constitutional monarchy, such an act is unprecedented. It damages not only the required trust between the Queen and prime minister, but their positions within the constitution. This is as untenable as it is unfathomable. We must insist that in any moment such as this, our constitution and the rule of law always win.