Pakistan's top court began hearing arguments on Monday on the legality of Prime Minister Imran Khan calling a general election after his party blocked a no-confidence vote and he dissolved parliament to prevent an opposition attempt to oust him.
Khan, a former cricket star, lost his majority in parliament last week as his opponents built support in advance of the vote of no-confidence that had been due on Sunday.
But the deputy speaker of parliament, a member of Khan's party, threw out the no-confidence motion that Khan had widely been expected to lose, ruling it was part of a foreign conspiracy and unconstitutional.
The standoff has thrown the nuclear-armed nation, which the military has ruled for almost half its history since independence in 1947, into a full-blown constitutional crisis.
Whatever the Supreme Court decides, Pakistan looks to be heading for fresh elections before the completion of the current term of the parliament and the prime minister in 2023.
If Khan prevails, polls will happen within 90 days. The opposition also wants early elections, albeit after delivering a political defeat to Khan by ousting him through a parliamentary vote.
Opposition leader Shehbaz Sharif called the blocking of the vote "nothing short of high treason".
"The nation is stunned," the English-language Dawn newspaper Dawn said in an editorial.
"Even as political pundits and the media confidently predicted Mr. Imran Khan’s defeat in the vote of no-confidence, he seemed unperturbed.
"No one could have guessed that his last ploy would involve having the democratic order burnt down."
Khan also dissolved the cabinet and wants a general election within 90 days, although that decision officially rests with the president and the election commission, and depends on the outcome of the court hearing.
The largely ceremonial head of state, President Arif Alvi, said in a statement that Khan would stay on as prime minister in an interim role until a caretaker prime minister was appointed under whom a general election would be held.
Alvi wrote to both Khan and Sharif, asking them to put forward names for a caretaker prime minister within three days, the president's office said in a statement.
But whether elections will happen depends largely on the outcome of the legal proceedings, which began with a five-member Supreme Court bench hearing arguments in a packed courtroom.
The Supreme Court could order that parliament be reconstituted, call for a new election, or bar Khan from standing again if he is found to have acted unconstitutionally.
The court could also decide that it cannot intervene in parliamentary affairs.
Khan says he did not act unconstitutionally, calling the move to oust him a plot orchestrated by the United States - a claim Washington denies.
After coming to power in 2018, Khan moved Pakistan closer to China and Russia and away from the United States. He has also blamed Narendra Modi, prime minister of nuclear rival India, for failing to protect the rights of minority Muslims there.
Political analysts say the military regarded Khan's conservative, nationalist agenda favorably when he won election in 2018 but later cooled towards him over various wrangles.
The military denies involvement in civilian politics but the generals are unlikely to stand by if they believe political chaos was damaging the country or if their core interests were threatened.