ISLAMABAD, Pakistan — It’s been a difficult few days for the party that used to run Pakistan.
First, the Pakistan Muslim League-Nawaz, known as the P.M.L.-N., came a distant second in the national election last Wednesday, winning about half as many parliamentary seats as the party headed by Imran Khan, a former cricket star.
Then Nawaz Sharif, the party’s figurehead and a former prime minister who was jailed by an anticorruption court this month, was rushed to a hospital on Sunday because of chest pains.
And on Monday, it appeared as if the party could lose another piece of its political empire: the legislature in Punjab, its longtime stronghold and Pakistan’s most populous province.
Mr. Khan, whose campaign was said to have been backed by the military, is still trying to gather enough support to form a majority coalition in the national Parliament. But on Monday, the influential newspaper Dawn was already calling him the prime minister in waiting.
While the national politics are being sorted out, Mr. Khan’s party has opened a second front in Punjab, which is home to the cities of Lahore and Rawalpindi and more than half of Pakistan’s 200 million people.
The Punjab legislature is considered the silver medal of Pakistani politics. Its lawmakers wield huge power over education, law enforcement and billions of dollars in development funds.
Mr. Khan’s party, the Pakistan Movement for Justice, won fewer provincial seats in Punjab than the P.M.L.-N., but over the weekend Mr. Khan persuaded several independent politicians to join his side. Though the P.M.L.-N. has also been wooing independents, analysts said that as of Monday night, Mr. Khan’s party maintained a slight edge.
Both the national Parliament and the Punjab legislature have been controlled for years by the P.M.L.-N., which in turn was dominated by Mr. Sharif. But he frequently clashed with another powerful player, the military, which has ruled Pakistan for much of its 70-year history either directly or through interference in political affairs.
Rights groups, academics and other observers have said that in the months leading up to the July 25 election, military and security officials targeted members of the P.M.L.-N. and other parties so that Mr. Khan could cruise to victory. They also say the military pressured the courts to remove Mr. Sharif from office last year and convict him in a corruption case this month.
In the ruling that ousted Mr. Sharif from office last year, the Supreme Court concluded that he and his family members could not adequately explain how they were able to afford several expensive London apartments and that they had failed to provide a money trail.
Analysts say his subsequent prosecution was timed to do the most damage to his party.
Mr. Sharif, 68, who is serving a 10-year prison sentence in Rawalpindi, was moved to a hospital in Islamabad, the capital, after being examined by doctors. Two years ago, he had open-heart surgery in London, and he also has diabetes and kidney problems. As he was sped through the hospital gates on Sunday, dozens of party workers who had gathered to show their support and affection shouted out, “We love you!”
His appeal has been scheduled for Tuesday, and his lawyer said that conditions at the prison and the stress of the electoral defeat had contributed to his deteriorating health.
“This has been very hard on him,” said Khawaja Haris, Mr. Sharif’s attorney, who was poring over a stack of highlighted legal documents on Monday afternoon in an Islamabad hotel.
Despite the alleged military support, Mr. Khan’s party fell short of an outright majority, and his bid to form a government has been complicated by his own success.
Mr. Khan ran personally for five seats and won them all, which the Pakistani news media said was unprecedented. But while candidates are allowed to run for multiple parliamentary seats in the same election, they can hold only one.
So Mr. Khan now has to relinquish four of his five seats; special elections will be scheduled in the coming months to fill the vacancies. The upshot is that his party will have at least four fewer votes in Parliament when it comes time to select a prime minister.
This, on top of a flurry of recount requests, could mean his party might not be as dominant as initially believed.
Still, most analysts predict that Mr. Khan, who struggled for years to build a political following while transforming himself from an elite socialite into a populist figure, will prevail.
“I have absolutely no reason to believe that anyone else will be the prime minister of Pakistan other than Imran Khan,” said Sohail Warraich, a well-known political commentator and author.
Jockeying for support in Parliament is typical after an election, he said, and the prospect of proximity to power would entice enough independent politicians and smaller parties to join Mr. Khan.
The Pakistan Movement for Justice is already planning Mr. Khan’s swearing-in, promising it will be “a people’s ceremony.”
A few days ago, some of the losing parties, furious about the military’s hand in the election, had threatened to stage street protests, and some candidates had even talked of boycotting Parliament and not taking their seats.
But those threats seemed to die down on Monday.
“There is no doubt the elections were systematically rigged,” said Said Qaisar Sharif, a spokesman for an Islamist political party. “But the country is not in a situation to face street protests.”
He, too, seemed to accept that Mr. Khan would be the next prime minister, using a common shorthand for Pakistan’s military and intelligence services.
“The establishment made them win the elections,” he said. “Therefore, the establishment will ensure Imran gets the number to become the P.M.”
Jeffrey Gettleman reported from Islamabad, and Daniyal Hassan reported from Lahore. Salman Masood contributed reporting from Islamabad.
Orignially published in NYT.