LAHORE, Pakistan — Imran Khan, a charismatic cricket star who has fiercely criticized American counterterrorism policy in a region plagued by extremism, appeared poised on Thursday to become Pakistan’s next prime minister.
After preliminary results showed his party decisively ahead, Mr. Khan addressed the nation, outlining what he would do as prime minister. He said he would fight corruption at the highest levels, improve relations with China, seek a “mutually beneficial” relationship with the United States and create a just welfare state along the lines of what the Prophet Muhammad did centuries ago.
“We’re going to run Pakistan in a way it’s never been run before,” he said.
He also said he would never live in the prime minister’s mansion. In a country of so many poor people, he said, “I would be embarrassed” to stay in a house like that.
For years, Mr. Khan had tried but failed to take the reins of this nuclear-armed Islamic republic, which has struggled with poverty, economic stagnation and instability and which is increasingly torn between its two biggest allies: China and the United States. But this time around, he found a powerful ally in Pakistan’s military.
In recent months, army and intelligence officers pressured, threatened and blackmailed politicians from rival parties, human rights groups have said, steadily narrowing Mr. Khan’s competition.
“The way this stage has been set, it would have been a surprise if he didn’t win,” said Nighat Dad, the executive director of Digital Rights Foundation, an advocacy group.
Friends and foes alike describe Mr. Khan, 65, as relentless, charming, swaggering and highly unpredictable.
As a young man, his good looks, his prowess on the cricket pitch and his success with women made him something of a fascination in England, where he lived for a time. In 1982, he posed for a London newspaper stretched out on a bed, wearing only briefs.
“Imran Khan is worried in case I portray him as a sex symbol,” wrote the journalist sent to interview him. “This is possibly why Imran is stretched across his hotel bed wearing only a petulant expression and a pair of tiny, black satin shorts.”
But a complex, mysterious transformation would begin soon. In 1992, Mr. Khan captained Pakistan’s cricket team to a World Cup victory over England, the country’s former colonial ruler. It was a moment of immense Pakistani pride, and Mr. Khan was at the center of it.
But looking back on it, he told interviewers, he felt empty.
He began to stay away from the clubs, the partying, the girlfriends. He launched himself on a quest to build a cancer hospital in Pakistan for the poor; his mother had died of cancer, and the two had been especially close.
He turned to Islam and the Sufi sect, which he said helped lend purpose to his life.
And then he entered politics. Pakistan in the late 1990s was a mess: Its Machiavellian spy services were working with the United States and at the same time supporting the Taliban and Osama bin Laden. The country was poor, troubled and divided — much of which could still be said today.
Mr. Khan seized upon a single issue: governance.
“In Pakistan, the main problem is not extremism,” he said in a recent interview with The New York Times. “It’s governance. We are a governance failure. And in any third world country, the moment the governance collapses, mafias appear.”
He homed in on corruption, repeatedly stating that a few political dynasties had shamelessly enriched themselves while governance continued to weaken, and the country grew poorer and poorer.
But Mr. Khan’s shouts for reform were not taken seriously at first. The Justice Movement he founded in 1996 initially won only one seat in Parliament — his — and a Pakistani newspaper ridiculed him as “Im the Dim.”
His personal life also careened back and forth, always attracting enormous attention, especially after he married a wealthy British heiress, Jemima Goldsmith. Ms. Goldsmith converted to Islam, they had two children, and they tried living in Pakistan together. But it did not last and they divorced. Mr. Khan married twice more, the last time to his spiritual healer, which again raised eyebrows across Pakistan.
But he seemed adept at not letting the gossip pages distract him, and he kept hammering on about corruption. And two years ago, he received a gift from the Panama Papers.
Those documents, an avalanche of millions of leaked confidential documents from a law firm in Panama, included several files that incriminated Pakistan’s prime minister at the time, Nawaz Sharif. Evidence began to build that Mr. Sharif had stolen millions of dollars from public coffers in Pakistan and used them to buy some very expensive apartments in London, under the names of his children.
Mr. Khan capitalized on this and called for Mr. Sharif to resign. Pakistan’s Supreme Court removed Mr. Sharif from office, and just two weeks ago, right before the election, Mr. Sharif and his daughter were sent to prison.
Few would disagree that corruption is out of control in Pakistan. But many observers here saw something in Mr. Sharif’s downfall that was more selective, possibly more sinister.
The widespread suspicion was that Pakistan’s powerful military and its intelligence services had pressured the judiciary to take out Mr. Sharif, clearing a path for Mr. Khan to take over. Mr. Sharif had clashed with the army chiefs, even some of those he had chosen himself, many times. He was a thorn in their side.
Mr. Khan, on the other hand, was someone the military bosses seemed to think they could work with. Analysts said he shared their worldview, in which Pakistan would kowtow less to the United States and talk more with the Taliban and other extremist groups.
In the prelude to the election, the military seemed to push even harder for Mr. Khan. Human rights groups, academics and members of other political parties said security officers threatened politicians in rival parties to defect to Mr. Khan’s side. Several did.
That does not mean that Mr. Khan was not genuinely popular. He was, especially among young men who lionized him as a sports hero. As nationwide elections drew closer, a Khan wave began to sweep Pakistan. His face was everywhere — on banners, lampposts and torn flags flying from the sputtering rickshaws that flit in and out of traffic. His supporters were the most energized and the most confident. His party’s symbol: a cricket bat.
Votes were still being tabulated on Thursday, but Mr. Khan’s party was far ahead of all the others, though still falling short of an outright majority in Parliament. According to results aired on state television, Mr. Khan’s party had won 120 seats, Mr. Sharif’s party had won 61 and a party run by the Bhuttos, one of Pakistan’s most storied political families, had notched 40.
It is widely expected that in the coming days, Mr. Khan will entice politicians from several different smaller parties to join a coalition government, with him as prime minister. Depending on how many smaller parties he woos, his government could be strong or weak.
What will Mr. Khan face?
Domestically, the challenges will be overwhelming. Pakistan’s electricity grid is falling apart, its infant mortality rates are among the most distressing in Asia, its currency is sliding, and its debt — especially to China — is ballooning. So many Pakistanis are unable to find jobs that every year, countless young men set off on a desperate exodus to the Middle East to work as street cleaners, luggage handlers, anything.
Internationally, Pakistan is in a pinch. China has extended it billions to build roads and other infrastructure, which at the current rate will be impossible to pay back.
At the same time, President Trump has slashed hundreds of millions of dollars in foreign aid. “They have given us nothing but lies & deceit, thinking of our leaders as fools,” the American president said of Pakistan in a tweet in January. “They give safe haven to the terrorists we hunt in Afghanistan, with little help. No more!”
Mr. Khan deeply disagrees with that.
“To blame Pakistan for that disaster is extremely unfair,” he said in the recent Times interview. “The moment the U.S. went into Afghanistan, everyone knew what was going to happen.”
“It was the history of Afghanistan,” he added, citing the defeat of occupying Soviet troops in the 1980s. Just as with the Soviets, he said, the longer the Americans stayed, the more resistance would grow.
Pakistan, he says, has borne “the brunt of the war on terror,” lamenting the thousands of people killed in his country. He has been a particularly vocal critic of American drone strikes.
All these positions play well with many Pakistanis. So does Mr. Khan’s recent support for the country’s strict blasphemy laws. Pakistan is a very socially conservative place, and about 96 percent of its citizens are Muslim.
Mr. Khan’s positions on religion have tacked back and forth over the years, like a sailboat trying to catch a breeze. But as the election drew closer, he seemed to set his course for the Islamists. In the past, he has expressed support for the application of strict Islamic law, including the amputation of thieves’ hands.
Mr. Khan has successfully rebranded himself as a populist alternative to Pakistan’s political elite, whom voters seemed more than ready to jettison.
But his life, in many ways, could not have been more different from that of most Pakistanis.
Born to a rich family in Lahore, Mr. Khan went to the best schools in Pakistan and in England, including Keble College, Oxford. He is independently wealthy, still travels abroad regularly and remains quite close to Ms. Goldsmith, despite their divorce.
Though many people who know him credit him with being charming, he can also come across as remote and desultory. His attendance record as an elected member of the National Assembly, Pakistan’s Parliament, was one of the worst of all sitting members.
Many analysts wonder how long Mr. Khan’s friendship with the military will last.
“He is known to have erratic behavior and a very unpredictable personality,” said Taha Siddiqui, a journalist, commentator and critic of the military who recently moved to France, saying he feared for his safety.
Follow Jeffrey Gettleman on Twitter: @gettleman.
Salman Masood contributed reporting from Islamabad, Pakistan; and Meher Ahmad and Daniyal Hassan from Lahore.
Fall, Imran, Khan, Leader, Pakistanamp039s, Rise