A Scottish court dealt another blow to Prime Minister Boris Johnson's Brexit plans Wednesday, ruling that his decision to suspend Parliament less than two months before the United Kingdom is due to leave the European Union was an unlawful attempt to avoid democratic scrutiny.

The government immediately said it would appeal, as the political opposition demanded Johnson reverse the suspension and recall lawmakers to Parliament.

With Brexit due in 50 days, the court ruling deepened Britain's political deadlock. Johnson insists the country must leave the EU on Oct. 31, with or without a divorce deal to smooth the way. But many legislators fear a no-deal Brexit would be economically devastating and are determined to stop him.

Their case got a boost late Wednesday as the government gave in to a demand from legislators and published a classified document sketching out the potential impact of leaving the EU without a divorce deal.

Dubbed "Operation Yellowhammer," the worst-case assumptions released Wednesday warn of severe disruption to cross-Channel routes, affecting the supply of medicines and certain types of fresh foods, and say that protests and counter-protests will take place across the country, accompanied by a possible rise in public disorder.

However, Michael Gove, the minister in charge of co-ordinating no-deal preparations, said after the document was leaked last month that it was old and did not reflect current levels of preparedness.

Earlier, justices at Scotland's highest civil court said in a surprise judgment that the government's action was illegal "because it had the purpose of stymieing Parliament."

Johnson claims he shut down the legislature this week so that he can start afresh on his domestic agenda at a new session of Parliament next month. But the five-week suspension also gives him a respite from rebellious lawmakers as he plots his next move to break the political impasse over Brexit and lead Britain out of the EU by Oct. 31, "do or die."

The Scottish judges said "the only inference that could be drawn was that the U.K. government and the prime minister wished to restrict Parliament."

They ruled that the suspension, known as prorogation, was "null and of no effect," but referred the matter to the Supreme Court for resolution. A hearing there is due to begin Tuesday.

Johnson denied he was being anti-democratic.

"If opposition members of Parliament disagree with our approach, then it is always open to them to take up the offer that I've made twice now — twice! — that we should have an election," he said in an online question-and-answer session. "There is nothing more democratic in this country than a general election."

Opposition politicians, however, insisted that the government must recall Parliament. Lawmakers were sent home this week despite the objections of House of Commons Speaker John Bercow and opposition lawmakers, who held up signs in the chamber saying "Silenced."

"He should do the right thing now, which is to reopen Parliament, let us back to do our job and to decide what to do next," said Labour Party Brexit spokesperson Keir Starmer.

A pro-EU protester shows a poster in front of the Houses of Parliament's entrance in London on Wednesday. (Frank Augstein/Associated Press)

Dominic Grieve, one of 21 lawmakers kicked out of the Conservative group in Parliament by Johnson last week after voting against the government, said it was possible the prime minister had misled Queen Elizabeth — whose formal approval is needed to suspend Parliament — about his motives.

He said if that turned out to be true, the prime minister would have to "resign — and very swiftly."

The court ruling came after more than 70 opposition lawmakers challenged the government's decision shut down Parliament until Oct. 14 — just over two weeks before Britain is due to leave the EU.

Last week, a court in Edinburgh rejected the lawmakers' challenge, saying it was a matter for politicians, not the courts, to decide. But that was overturned Wednesday on appeal.

Appeal planned

The British government said it was disappointed by the decision and would appeal to the Supreme Court.

It noted that another challenge to the suspension, brought by transparency campaigner Gina Miller, was rejected at the High Court in London last week by judges who said the decision was inherently political and "not a matter for the courts."

With a no-deal Brexit looming, rebel members of the governing Conservatives joined with the opposition to deliver a series of blows to Johnson in the days before Parliament was suspended. They passed a law that orders the government to seek a three-month delay to Brexit if no agreement has been reached by late October, and rejected Johnson's call for a snap general election.

Britain's 2016 decision to leave the EU has left the country's politics gridlocked and tested to the limit the U.K.'s largely unwritten constitution.

Both the Conservatives and main opposition Labour Party are divided over Brexit, and voters of all stripes are fed up.

Johnson, one of the leaders of the 2016 "leave" campaign, is trying to deliver Brexit and counter an electoral threat from the newly-founded Brexit Party. Its leader Nigel Farage took out newspaper ads Wednesday, offering an electoral pact with the Conservatives if Johnson backed a "clean break" — a no-deal Brexit.

"If we go beyond the 31st of October, and we are still a member of the European Union — which looks increasingly likely — then a lot of votes will shift from the Conservative Party to the Brexit Party," Farage told reporters.

Johnson ruled out a pact with Farage.

Labour is caught between those who want to go through with Brexit — albeit a softer version — and a faction that wants to reverse the decision.

Leader Jeremy Corbyn says the party will negotiate a new and improved withdrawal agreement with the EU. But his deputy, Tom Watson, argued Wednesday that there is "no such thing as a good Brexit deal," and Labour should campaign to remain in the bloc.

Johnson says he wants to strike a new deal with the bloc after the agreement made by his predecessor Theresa May was rejected three times by Britain's Parliament. But EU officials say the U.K. has made no concrete proposals.

German Chancellor Angela Merkel said Wednesday that "we still have a chance to achieve this in an orderly way," but that Germany was also prepared for a no-deal Brexit.