“It is a great pity that it should have been necessary for the court to intervene,” said Jonathan Sumption, who served as a Supreme Court justice from 2012 to 2018. “But if the government takes an ax to the political convention and there are no rules, then there is a complete void in which the executive can act however it likes.”

At issue was whether Mr. Johnson, in suspending Parliament for five weeks in the middle of a dispute over Britain’s departure from the European Union, had stymied the ability of lawmakers to have a say in that process. The court, in upholding a previous ruling by a Scottish high court, judged that he had.

Not only did the court declare the prime minister’s action unlawful, it also declared the order itself, which Queen Elizabeth II issued at Mr. Johnson’s request, “unlawful, void, and of no effect.” The request, said the court’s president, Baroness Brenda Hale, might as well have been a “blank sheet of paper.”

Stephen Tierney, a professor of constitutional theory at Edinburgh University, said it was “astonishing” that the court had ruled decisively that it “can review something as fundamental as that, done by Her Majesty, as unlawful.”

“The court is getting involved in what was largely seen as the internal workings of Parliament and its supreme power,” Professor Tierney said. “That in itself is unprecedented in the U.K. system. It’s far more similar to the sort of judicial review you’d get in a country with a codified constitution. But to arrive at its conclusion the court has had to pluck unwritten constitutional principles from what they take to be political practice.”

In the United States, the courts have intervened regularly to challenge actions of the Trump administration, such as its ban on visitors from predominantly Muslim countries. The Supreme Court routinely exercises judicial review by actively interpreting the American Constitution.