KABUL — The Trump administration’s special adviser on Afghan peace met last week with Taliban representatives in Qatar for talks that included “working toward finding a peaceful resolution” to the war, a spokesman for the insurgent group said Saturday.

The spokesman, Zabiullah Mujahid, said the presence of foreign troops in Afghanistan remains the “greatest obstacle” to peace, but he also noted that both sides agreed to continue the dialogue — a potentially major step toward formal negotiations with the Taliban to end the 17-year war.

The U.S. Embassy in Kabul said in a statement that U.S. envoy Zalmay Khalilzad held “consultations” last week in Islamabad, Pakistan; Riyadh, Saudi Arabia; and Doha, Qatar. The embassy did not confirm the reported meeting with Taliban officials.

It said Khalilzad returned to Kabul for follow-up meetings with Afghan President Ashraf Ghani and other officials, as well as political and civic groups, “to hear their views and priorities on a settlement.” Ghani’s office confirmed that scenario.

The reported talks would mark another significant outreach to Taliban representatives in Qatar, which has sought to act as a mediator. A first breakthrough meeting was held there in July with Alice Wells, a senior State Department official. U.S. officials have never publicly confirmed the meeting.

Khalilzad’s reported meeting came just weeks after he was named Washington’s point man on Afghan peace. He first visited Kabul and Islamabad, the Pakistani capital, early last week, then vanished from public view. His published schedule also included visits to Saudi Arabia and the United Arab Emirates, but U.S. officials have not commented on those. 

The potentially encouraging news from Doha came as the latest violent attack targeted Afghan candidates for parliamentary elections scheduled for Saturday. A bombing at a campaign rally in northern Takhar province killed more than 20 people. No group claimed it, but the Taliban warned that it would seek to disrupt the polls, and more than 300 people have already died in election-related attacks.

Khalilzad’s public one-day visit Monday to Pakistan resulted in little more than platitudes. Officials there were polite but cool, and Pakistan’s foreign minister stated in Washington that Khalilzad — who once suggested the country be declared a terrorist state — needs to be more “sensitive” in his new role.

Pakistan has long said it seeks peace in Afghanistan, but Afghan and U.S. officials have accused it of covertly sheltering anti-Afghan militants, and Washington has suspended $300 million in military aid. A key part of Khalilzad’s assignment is to persuade Pakistan to actively back peace talks. 

In Afghanistan — where Khalilzad was born and served as U.S. ambassador in the early 2000s — his previous diplomatic tenure was marred by accusations of political strong-arming. But last week, his pro-peace agenda earned a cordial reception. Ghani has long sought to revive talks with the Taliban, and hopes for progress soared after a first-ever three-day truce in June.

Khalilzad told journalists in Kabul on Monday that Afghan and Taliban leaders should name their negotiating teams. He said the United States would be happy to participate in any talks, but that the peace process should remain “Afghan-owned.”

His message stood in sharp contrast to that of Erik Prince, the American security contractor who visited Kabul two weeks ago to promote privatizing the armed conflict. In an interview on Afghan TV, the former Blackwater chief boasted that his fighters could turn around the war in six months. Afghan reaction was uniformly negative, and U.S. military officials have dismissed the idea. 

“In some respects, Khalilzad is the perfect person for this job. He understands the terrain, the politics, and the state of play in Pakistan and the region,” said Michael Kugelman, an expert on Pakistan and Afghanistan at the Woodrow Wilson International Center for Scholars in Washington. 

Kugelman noted, though, that his past criticisms of Pakistan could hinder Khalilzad’s ability to “make headway with Islamabad.” Other analysts said gaining the support of other regional powers is also needed to settle the conflict and that it will require more than one-man shuttle diplomacy.

“Mr. Khalilzad cannot do a lot,” said Ahmad Zia Rafat, a university professor in Kabul. “The question is, are the main players — such as the U.S., Iran, Pakistan, India, China and Iran — ready for peace here or not?”

Kugelman emphasized that within Afghanistan, too, the insurgents’ continued attacks and widening control of territory remain stubborn obstacles to Khalilzad’s mission.

“We shouldn’t overstate his ability to move mountains,” he said. “The fundamental question remains the same: how to convince the Taliban to stop fighting when it thinks it’s winning the war.”

Sayed Salahuddin in Kabul and Shaiq Hussain in Islamabad contributed to this report.