US Secretary of State Mike Pompeo said on Wednesday he was “hopeful” of resetting the troubled relationship with Pakistan following his meeting with Prime Minister Imran Khan and other senior civil and military officials in Islamabad.

The shift in tone comes days after Washington confirmed plans to cancel $300 million in military aid.

PM Khan also voiced his optimism at a fresh start in the rocky ties between the wayward allies.

The former CIA director, making his first visit as top US diplomat to Pakistan, told pool reporters shortly before leaving Islamabad that the “broad spectrum” of topics discussed included efforts “to develop a peaceful resolution in Afghanistan”.

“I'm hopeful that the foundation that we laid today will set the conditions for continued success,” he said — though he added there was a “long way to go” before Washington would resume military assistance.

The White House believes that Pakistan's Inter-Services Intelligence agency and other military bodies have long helped fund and arm the Taliban both for ideological reasons and to counter rising Indian influence in Afghanistan. Islamabad denies the allegations.

Pompeo's counterpart Foreign Minister Shah Mehmood Qureshi told reporters the meetings had been “positive”, adding this was largely because the US and Pakistan now agreed that in Afghanistan “there is no military solution, we will have to go towards a political solution”.

He also said that Pompeo's comments hinted the US may be considering direct talks with the Taliban.

The Taliban have long insisted on direct talks with the US, which Washington has repeatedly refused, insisting negotiations must be Afghan-led. But in June Pompeo indicated a change in the longstanding policy, with US officials meeting Taliban representatives in Doha in July.

'Shared goal'

The cancelled military aid is part of a broader freeze announced by the Trump administration in January designed to pressure Pakistan into action.

Pompeo said ahead of the trip that it was time to “turn the page” and suggested that the election of PM Khan, who has vowed to seek better relations with the US, could provide a fresh impetus.

“A sportsman always is an optimist,” the former cricketer, who captained Pakistan to World Cup victory in 1992, was quoted as saying when asked about finding a new way forward with Washington. “He steps on the field and he thinks he's going to win.”

Pompeo, who was later joined by General Joe Dunford, chairman of the Joint Chiefs of Staff, also met with General Qamar Javed Bajwa.

In earlier comments, Pompeo also held out the possibility that military aid could be restored under the right circumstances.

The $300 million was part of the Coalition Support Fund, set aside to refund Pakistani spending on counter-terrorist operations and help pay Islamabad for allowing US and other Nato supplies into Afghanistan.

The latest remarks represent a change in tone towards Pakistan and its new prime minister, who came to office in July amid concerns of his tolerance of terror groups.

Pompeo also confirmed that Zalmay Khalilzad, a high-profile former US ambassador to Kabul, Baghdad and the United Nations, would be appointed to lead peace efforts in Afghanistan.

Pompeo spent just a few hours in Pakistan before travelling on to New Delhi, where he will be joined by Defense Secretary Jim Mattis to meet their Indian counterparts on a range of defence and trade issues.