On Tuesday, at the same time the prime minister was meeting with Mr. Trump, Jeremy Corbyn, the leader of the Labour Party, told a cheering audience at his party’s conference that Mr. Johnson had “misled the country” and would soon become “the shortest-serving prime minister there’s ever been.”

Mr. Johnson reiterated his call for a general election, but there were no signs he was any closer to winning the necessary two-thirds approval in Parliament to schedule a vote. Parliament seemed likely to lapse back into paralysis as the deadline for Britain’s exit from the European Union — Oct. 31 — draws closer.

Defenders of the prime minister complained that the court ruling would weaken his hand in negotiating an exit deal with Brussels. That contention seemed debatable, given the deep gulf between the two sides, but the court’s decision certainly tarnishes him at home, at a time when his other stumbles have yet to dent his popularity.

Unlike in the United States, there is little precedent in Britain for judicial review of government decisions. That had led political and legal analysts to speculate that the court might decide it had no authority to rule on the prime minister’s actions, or to deliver a limited rebuke.

Instead, the court’s 11 justices cast aside this tradition of restraint and delivered an unsparing denunciation of the government’s actions, and an unequivocal victory for the prime ministers’ opponents.

“The decision to advise Her Majesty to prorogue Parliament was unlawful because it had the effect of frustrating or preventing the ability of Parliament to carry out its constitutional functions without reasonable justification,” said the court’s president, Lady Hale, using the British term for suspending the body.