ISLAMABAD – Prime Minister Nawaz Sharif was ousted from power Friday by the country’s Supreme Court after months of hearings on corruption charges against Sharif and his family, throwing Pakistan’s political future into turmoil.

In an historic ruling, all five members of a high court bench voted to disqualify Sharif from office, reinforcing its previous findings that the prime minister had lied to the nation about his family’s wealth and financial dealings. It referred the case to a special “accountability” court for prosecution.

Sharif, 67, has said he would accept the court’s verdict in the “Panama Papers” case, in which opposition leaders charged that the Sharif family had hidden its wealth overseas through a complex trail of real estate transactions. Before the ruling, one of the justices described these dealings as “mafia” behavior.

It was not clear whether Sharif’s ruling Pakistan Muslim League-N party would call a snap election or nominate a substitute leader until elections scheduled for next year. But the bombshell ruling left the party in shambles and gave a powerful boost to Sharif’s main political opponent, former cricket star Imran Khan, who brought the original case against him.

Sharif was overthrown by the army in 1999 during a previous term as prime minister, and is one of numerous Pakistani leaders who have failed to complete their tenure because of military coups, judicial action or intervention by the president.

The capital was tense Friday as the nation awaited the verdict. Riot police and paramilitary officers surrounded the Supreme Court building, and the military was on high alert. The courtroom was packed as the ruling was announced, with opposition leaders in the room.

Supporters of opposition parties celebrate the dismissal of Pakistani Prime Minister Nawaz Sharif in Peshawar on Friday. Associated Press photo/Muhammad Sajjad

Soon after the announcement, a spokesman for Sharif – who was in his third term as leader of the nuclear, Muslim-majority nation of 180 million – said “the prime minister has ceased to perform his official duties” despite his “strong reservations” about the court’s decision.

“Nawaz Sharif lives in the heart of the masses. He does not need a ruling chair,” Information Minister Mariyum Aurangzeb told reporters outside the building.

But some Muslim League figures swiftly turned against Sharif. The interior minister, Nisar Ali Khan, said he was likely to leave his post if the prime minister was disqualified. On Friday, he announced that Sharif and his children had been put on a list of Pakistanis who are not allowed to travel outside the country.

Khan’s supporters held spontaneous celebrations outside his home in the Islamabad suburbs and elsewhere, dancing and chanting and distributing sweets. But a spokesman for Khan said only that, “at this delicate moment, all patriotic Pakistani political parties need to unite.”

The charismatic grass-roots leader has led mass public rallies against Sharif for the past several years and condemned him as a corrupt, wealthy politician.

The case against Sharif stemmed from leaked documents from a law office in Panama in early 2016 alleging that numerous foreign leaders including the Sharifs had hidden assets in overseas holdings. The charges against Sharif centered on the murky ownership and source of funds for a group of luxury apartments in London long occupied by his children.

After months of hearings, a Supreme Court panel in April ruled 3 to 2 against disqualifying Sharif from office, but it ordered a special investigation into the family’s convoluted financial transactions and raised numerous questions, often in sharp and skeptical language, about where “huge sums” had come from to pay for various properties. Friday’s ruling came shortly after the investigation was completed.