In November, Pakistan’s leading daily newspapers in Peshawar carry front-page news of the Donald Trump presidential victory in the U.S. elections. (Arshad Arbab/EUROPEAN PRESSPHOTO AGENCY)

First there was a moment of panic, when Pakistanis struggled to absorb the news last month that Donald Trump, who had threatened to bar foreign Muslims from the United States and suggested it was time to “get tough” with Pakistan for sheltering terrorists, was the U.S. president-elect.

Then came a moment of glory, when Trump showered compliments on Pakistan in a phone call with Prime Minister Nawaz Sharif two weeks ago, using words like “fantastic” and “terrific,” and hinting casually that he would be willing to help Muslim-majority Pakistan solve its historic differences with India, a much larger Hindu-led rival next door.

Now both the shock and euphoria have worn off, leaving Pakistanis scrambling to prepare for an unpredictable new phase in their country’s wary but enduring partnership with Washington, which has included Cold War and anti-terrorism military alliances as well as sharp differences over Pakistan’s nuclear testing and harboring of Islamist insurgents.

Last week, the Pakistani government sent a special emissary, Tariq Fatemi, to Washington, where he hinted broadly that Sharif might like to attend Trump’s inauguration and said he believed the incoming administration would provide Pakistan with “a fresh opportunity to burnish its credentials” with the United States.

Pakistan's Prime Minister Nawaz Sharif addresses the General Assembly at the United Nations on Sept. 21 in New York City. (Spencer Platt/Getty Images)

Pakistanis do have reason to believe that Trump’s long-distance offer to mediate with India was more than a throwaway line. Vice President-elect Mike Pence repeated that offer in a clear, deliberate statement several days ago, saying the administration planned to be “fully engaged in both nations” and was prepared to play a “pivotal role” in resolving the key dispute over Kashmir.

And, after the initial worry here that Trump’s limited knowledge of foreign affairs and anti-Muslim suspicions might work against the nation’s interests, some Pakistani experts are now positing that there might be a “silver lining” in having a brash dealmaker in the White House, unburdened by historical caveats and eager to make his mark. 

India has adamantly resisted past U.S. offers to mediate over Kashmir, the border region claimed by both countries that has recently been roiled by violent protests and terrorism attacks. In October, a high-profile effort by Sharif at the United Nations to draw attention to abuses by Indian troops there was undercut by a gruesome attack that killed 17 ­Indian soldiers, and which India immediately blamed on Pakistan. 

“The key issue for the U.S. is that escalation could spark a conflict between two nuclear powers,” said Awais Leghari, who is chairman of the foreign affairs committee in Pakistan’s Parliament. “We cannot resolve these issues without superpower help, and it needs someone who is out of the box, someone radical enough to put an international hand into a sincere effort.

“But this is more than a simple phone call,” he added. “It needs a lot of hard work.” 

Other Pakistani voices, however, caution that Trump is far more likely to lean toward India, a country where he has made serious investments — including Trump Towers in two cities — and whose leaders have made a concerted effort to woo America in the past few years. 

“For all Trump’s praise, Washington’s tilt to India is real,” said Huma Yusuf, a columnist for Pakistan’s Dawn newspaper. “We should be less caught up with his gushing words.”

The larger issue bedeviling Pakistan’s relationship with the United States — its ambivalent role in insurgent-plagued Afghanistan — has a more direct effect on American interests and lives, with about 10,000 U.S. troops still on the ground. Pakistani officials, stressing their long cooperation with U.S. drone strikes and other anti-terrorism measures along the Pakistan-Afghanistan border, said they hope the Trump administration will be more appreciative of their peacemaking efforts and internal insurgent threats.

But experts here said this will be a far more difficult case for Pakistan to make. This week, Pakistani newspapers gave prominent coverage to statements by senior U.S. officials, including Gen. John W. Nicholson, the top commander in Afghanistan, that the Haqqani network, long based in Pakistan, is the single most serious threat to Afghanistan’s security. “They do enjoy sanctuary inside Pakistan,” Nicholson said. The White House spokesman voiced a similar concern. 

Senior Pakistani officials said they take the long view of their country’s relationship with the United States, which has been dominated by military and intelligence ties. They stressed the close bilateral collaboration during the Soviet invasion of Afghanistan in the 1980s and in the war on terror after the 9/11 attacks, and expressed confidence that this closeness will survive, no matter who is in the White House.

“Our relationship with the United States is almost as old as Pakistan itself. There have been ups and downs, but overall we have remained very close,” Sartaz Aziz, the government’s senior foreign policy official, said in an interview Thursday. “Through both Republican and Democratic administrations, there has been a broad continuity in policy, and we fully expect our relations will continue on an uphill trajectory.” 

Officials here said they also want to reassure the incoming administration that their relations with other countries are not a “zero-sum game” and are independent of their policies toward the United States. They insisted that their deepening economic trade and plans for a major transportation corridor to China do not represent a “pivot” away from their longtime economic and military links with Washington. 

Aziz also insisted that Pakistan, like the United States, wants to see Afghanistan become peaceful and stable. He said that Pakistan has been “frustrated” that its efforts to arrange peace talks with the Taliban have failed, and that rising attacks in Afghanistan have been partly the result of Pakistan’s military raids to drive the insurgents out of the tribal border areas. “To blame everything on Pakistani sanctuaries is simplistic,” he said. 

So far, Trump has hewed more closely to the Obama administration’s thinking on Afghanistan, although he has suggested at different times that he might withdraw U.S. forces or keep them there. But when it comes to the broader issue of Islamist terrorism, Trump has been consistently strong in his views that it must be stopped — and he has shown no qualms about playing hardball with Pakistan on the subject. 

Just six months ago, in a comment that infuriated Pakistanis, Trump told Fox News that he might force Pakistan to release a local doctor, Shakeel Afridi, who was sent to prison after being accused of spying for the United States by running a fake vaccination campaign in the area where Osama bin Laden was killed in 2011 by U.S. Special Operations forces. The doctor is widely viewed here as a traitor. 

Trump, then in the early stages of his presidential campaign, boasted bluntly that he could get Afridi freed “in two minutes” because Pakistan receives so much American aid. The United States, he declared, “can’t help Pakistan as long as it punishes people who help the war on terror.”

Pakistan’s interior minister, Chaudhry Nisar Ali Khan, reacted with great umbrage, saying the statement “serves to show not only his insensitivity, but also his ignorance about Pakistan.”