Britain’s highest court on Tuesday ruled that Prime Minister Boris Johnson’s decision to suspend Parliament in the run-up to Brexit was “unlawful” — sparking immediate calls for his resignation.

The Supreme Court’s 11 judges agreed unanimously in a severe blow to New York-born Johnson, who became prime minister just two months ago.

He had prorogued — the formal term for the suspension — Parliament for five weeks, telling Queen Elizabeth II that it was a routine closure despite it coming so close to his key Brexit deadline on Oct. 31.

Senior Judge Brenda Hale said the suspension “was unlawful because it had the effect of frustrating or preventing the ability of Parliament to carry out its constitutional functions without reasonable justification.”

The court also ruled that the suspension was “void and of no effect” — meaning Parliament is technically still sitting.

Speaker John Bercow insisted parliamentary sessions must “convene without delay” and said he would “consult the party leaders as a matter of urgency.”

The news came as Johnson was in New York for the United Nations General Assembly — with him reportedly defiant and refusing to quit.

Opposition leader Jeremy Corbyn led the calls for Johnson’s resignation Tuesday, saying the decision showed his rival’s “contempt” for democracy and the rule of law.

“I invite Boris Johnson, in the historic words, to consider his position,” Corbyn said, noting that it would make Johnson “the shortest-serving prime minister there’s ever been.”

Scottish National Party lawmaker Joanna Cherry, one of those who brought the legal case against him, agreed.

“His position is untenable and he should have the guts for once to do the decent thing and resign,” she said Tuesday.

Activist Gina Miller, another of those who brought the legal action, said, “Crucially today’s ruling confirms that we are a nation governed by the rule of law, laws that everyone, even the prime minister, is not above.

“MPs should turn up for work tomorrow and get on with scrutinizing this government.”

The decision followed three days of hearings last week before the panel of 11 judges.

The court rejected the government’s assertions that the decision to suspend Parliament until Oct. 14 was routine and not related to Brexit. Government lawyers claimed that under Britain’s unwritten constitution, it is a matter for politicians, not courts, to decide.

The government’s opponents argued that Johnson illegally shut down Parliament just weeks before the country is due to leave the 28-nation European Union for the “improper purpose” of dodging lawmakers’ scrutiny of his Brexit plans.

They also accused Johnson of misleading the queen, whose formal approval was needed to suspend the legislature.

Johnson and Parliament have been at odds since he took power in July with the determination to take Britain out of the EU on Oct. 31 with or without a divorce deal with Europe.

With Post wires