Pakistan’s supreme court will rule Thursday on the legality of political manoeuvres that led Prime Minister Imran Khan to dissolve the national assembly and call fresh elections.

The court is deciding if the deputy speaker of the assembly violated the constitution by refusing to allow a no-confidence vote against Khan at the weekend.

The move allowed Khan to get the presidency — a largely ceremonial role taken by a loyalist — to dissolve parliament and order an election, which must be held within 90 days.

Had the vote taken place, Khan was certain to have been booted from office.

“We will re-assemble for the announcement of judgement at 7:30pm (1430 GMT) today,” said chief justice Umar Ata Bandial.

Bandial said previously that the court will rule only on the legality of the assembly deputy speaker’s actions, so it was not immediately clear what effect any judgment may have — although there is precedent.

In 1988, Muhammad Khan Junejo appealed to the court after the assembly was dissolved by then-president General Zia-ul-Haq, who had taken power in a military coup years earlier.

The court agreed his government had been dissolved unconstitutionally but ruled that since elections had been announced anyway it was best to move on.

Bandial hinted at similar pragmatism on Thursday.

“There is a lot of bitterness between the parties in the assembly and we have to think whether they will be able to get along,” he said.

Pakistan has been wracked by political crisis for much of its 75-year existence, and no prime minister has ever seen out a full term.

There had been high hopes for Khan when he was elected in 2018 on a promise of sweeping away decades of entrenched corruption and cronyism, but he has struggled to maintain support with soaring inflation, a feeble rupee and crippling debt.

The opposition had expected to take power on Sunday after mustering enough support to oust him, but the deputy speaker refused to allow the vote to proceed because of alleged “foreign interference”.

Khan said the opposition had gone too far by colluding with the United States for “regime change”.

The cricket star-turned-politician says Western powers want him removed because he will not stand with them against Russia and China, and the issue is sure to ignite any forthcoming election.

Washington has denied any interference.