ISLAMABAD, Pakistan — Pakistan’s Supreme Court on Friday ordered the removal of Prime Minister Nawaz Sharif from office over accusations of corruption, delivering a ruling that is likely to shift the country’s tumultuous political balance and deal a serious blow to the legacy of a man who helped define the past generation of Pakistani politics.
The removal of Mr. Sharif, who was serving his third term in office, comes roughly a year before his term was to end.
The verdict means the governing political party, the Pakistan Muslim League-Nawaz, must choose an interim prime minister to replace Mr. Sharif until the next general election, which is scheduled for mid-2018.
Announced by the five-member Supreme Court, the verdict caps more than a year of high political drama, breathless court proceedings and a piercing investigation into the finances of the Sharif family.
Watching the courtroom drama was the country’s powerful military, which has traditionally decided the fate of civilian governments. There had been hushed speculation that the court, in coming to its decision, had the tacit, if not overt, backing of powerful generals.
The charges against Mr. Sharif and three of his children — two sons and a daughter — stemmed from disclosures last year in the Panama Papers, which revealed that the children owned expensive residential property in London through a string of offshore companies.
In their unanimous verdict on Friday, the justices declared that Mr. Sharif was not “honest” and that he therefore was “disqualified to be a member of the Parliament.” They also ordered the opening of criminal investigations against the Sharif family.
Imran Khan, the opposition politician who has been spearheading the campaign against Mr. Sharif since he took power in 2013, stands to gain the most politically from the removal of Mr. Sharif. Mr. Khan has doggedly and almost obsessively led the charge against Mr. Sharif and rallied a wide swath of the public against him through a mix of street agitation and court petitions.
The Supreme Court had asked the members of the Sharif family to provide a paper trail of the money they used to buy their London apartments. Investigators found that they were “living beyond their means.”
Despite repeated court exhortations, Mr. Sharif’s family and its lawyers failed to provide satisfactory documentation, the justices said. Several of the documents they produced were declared fake or insufficient.
A representative of the governing party said that Mr. Sharif was stepping down because of the court verdict. But the party expressed “strong reservations” over the ruling and said it was contemplating “all legal and constitutional means” to challenge it, the representative added in a statement.
In 1990, Mr. Sharif was ushered into power as head of the Pakistan Muslim League. As his business grew, suspicions of corruption surfaced. He was dismissed by President Ghulam Ishaq Khan in 1993. The Supreme Court eventually deemed his dismissal unconstitutional, but Mr. Sharif resigned under pressure from Pakistan’s powerful military.
Mr. Sharif was elected again in 1997. Two years later, a military coup ended his term after he fired the army chief, Gen. Pervez Musharraf, and then, according to reports, kept the general’s return flight to Pakistan from landing. Troops loyal to Gen. Musharraf seized the Karachi airport and overthrew the prime minister. Mr. Sharif was tried and found guilty of hijacking and terrorism and sentenced to life in prison.
After spending seven years in exile in a deal brokered by the Saudi royal family, Mr. Sharif returned to Pakistan in 2007. He was cleared of criminal charges and deemed eligible to run for office. Mr. Sharif was again elected prime minister in 2013, but he was met with opposition and faced large protests in 2014. He was tried on corruption charges after the 2016 Panama Papers revealed that his children owned expensive homes in London through a string of offshore companies.
Mr. Sharif has called the inquiry into his family’s finances a conspiracy and has asserted that in his three terms as prime minister he has not been tarred by a major corruption scandal. He repeatedly rebuffed calls to resign and said that he had done no wrong.
The ruling, while expected, leaves unanswered the long-term fate of the man who has been a dominating force in Pakistani politics for the better part of three decades.
“I did not expect Nawaz Sharif to go scot-free,” said Hasan Askari Rizvi, a prominent political analyst who is based in Lahore.
“If he has a long-term vision, he will sit back and guide his political party,” Mr. Rizvi added. “He and his supporters will portray the court verdict as victimization and a grave conspiracy involving international powers.”
Mr. Sharif’s removal from office throws his political succession plans into disarray. His daughter Maryam Nawaz Sharif, who was being groomed as his political heir, was also implicated in the case.
Political insiders say there are several possible contenders to replace Mr. Sharif: Sardar Ayaz Sadiq, the speaker of the national assembly; Shahid Khaqan Abbasi, the minister of petroleum; Khurram Dastgir Khan, the commerce minister; and Khawaja Muhammad Asif, the defense minister.
“Whoever they bring will be a weak prime minister, as Nawaz Sharif would want to have someone who is more or less in line with his thinking,” Mr. Rizvi said.
Mr. Khan’s supporters had laid siege to the Parliament and other government buildings in 2014 after accusing Mr. Sharif of rigging the 2013 general elections. Another attempt to blockade the capital in 2016 was unsuccessful, but it forced the Supreme Court justices to take up the Panama Papers case.
“The whole country is at a standstill due to the Panama Papers case,” Mr. Khan said. Critics said Mr. Khan was pressuring the courts.
Political analysts say the court verdict hands Mr. Khan an undeniable political and moral victory.
“Imran Khan will be strengthened, but it remains to be seen how he capitalizes in Punjab Province, which is critical to winning the general elections,” Mr. Rizvi said. Punjab, the most populous and prosperous of the country’s four provinces, has remained a stronghold of Mr. Sharif for decades.
Mr. Sharif presided over a period of relative economic stability and was able to complete a few large infrastructure projects while reducing the crippling power outages that have long afflicted Pakistan.
But the stubborn scandal over the London real estate holdings sullied the reputation of the family.
Mr. Sharif’s political party nonetheless hopes that his achievements can bring it another electoral success next year even if Mr. Sharif cannot run for office. Mr. Sharif is expected to campaign for his party.
During his current tenure, Mr. Sharif had an uneven relationship with the powerful military. His overtures of more openness toward India, Pakistan’s longtime foe, backfired as generals spurned his efforts.
More recently, relations with the military took a darker turn after news reports detailed how civilian officials confronted the military over what they called a failure to act against Islamist groups. Mr. Sharif had to fire his information minister and two top aides to placate the army.
Bilawal Bhutto Zardari, the chairman of the Pakistan Peoples Party, said the Panama Papers ruling was “a real test of our system.”
Some predicted a politically volatile time ahead.
“Until the elections, this will lead to a period of political instability,” Amber Rahim Shamsi, a prominent journalist who hosts a show on Dawn TV, said of the verdict.
“The Sharif political dynasty has somehow managed to survive Pakistan’s rough and bloody politics for over three and a half decades through wheeling and dealing,” Ms. Shamsi said. “It is hard to imagine all the family falling like a pack of cards. Nawaz Sharif has a following and could cash in on political martyrdom to stage a comeback.”