KABUL/PESHAWAR, Pakistan (Reuters) - Taliban officials said U.S. negotiators on Saturday agreed on a draft peace pact setting out the withdrawal of foreign troops from Afghanistan within 18 months, potentially ending the United States’ longest war.

The details of the draft were given to Reuters by Taliban sources at the end of six days of talks with U.S. special peace envoy Zalmay Khalilzad in Qatar aimed at ending the war, more than 17 years since American-led forces invaded Afghanistan.

It stipulates that troops would leave within 18 months of the agreement being signed.

While no joint statement was issued, Khalilzad tweeted later that the talks had made “significant progress” and would resume shortly, adding that he planned to travel to Afghanistan to meet government officials.

“Meetings here (in Qatar) were more productive than they have been in the past. We have made significant progress on vital issues,” he wrote, adding that numerous issues still needed work.

“Nothing is agreed until everything is agreed and everything must include an intra-Afghan dialogue and comprehensive ceasefire,” he wrote in the tweets.

U.S. Secretary of State Mike Pompeo on Saturday wrote on Twitter that he had received “encouraging news” from Khalilzad about the talks.

“The U.S. is serious about pursuing peace, preventing #Afghanistan from continuing to be a space for international terrorism & bringing forces home,” Pompeo tweeted. He did not give a timetable for the potential withdrawal of U.S. forces.

A Taliban statement issued later also noted progress on troop withdrawal and other issues but said more negotiations and internal consultations were required.

“The policy of the Islamic Emirate during talks was very clear -- until the issue of withdrawal of foreign forces from Afghanistan is agreed upon, progress in other issues is impossible,” said Taliban spokesman Zabihullah Mujahid, using another name the group calls itself.

It was not clear whether the draft described by the Taliban sources was acceptable to both sides or when it could be completed and signed.

MAIN ENEMY

According to the sources, the hard-line Islamic group gave assurances that Afghanistan will not be allowed to be used by al-Qaeda and Islamic State militants to attack the United States and its allies -- a key early demand of Washington.

They said the deal included a ceasefire provision but they had yet to confirm a timeline and would only open talks with Afghan representatives once a truce was implemented.

Up until now, the Taliban has repeatedly rejected the Afghan government’s offer of holding talks, preferring instead to talk directly to the U.S. side, which it regards as its main enemy.

“In 18 months, if the foreign forces are withdrawn and ceasefire is implemented, then other aspects of the peace process can be put into action,” a Taliban source said, quoting from a portion of the draft.

More talks on the draft are expected in February, again in the Qatari capital Doha, the Taliban sources said.

FILE PHOTO: U.S. troops walk from a Chinook helicopter in Uruzgan province, Afghanistan July 7, 2017. REUTERS/Omar Sobhani/File Photo

They expect their side to be led by new political chief Mullah Abdul Ghani Baradar, the movement’s co-founder and a former military commander who was released from prison in Pakistan last year.

While they said his appointment had boosted momentum for a deal, it was unclear if he had joined the talks.

NEAR-DAILY ATTACKS

News of progress on a deal comes as the Taliban continues to stage near-daily attacks against the Western-backed Afghan government and its security forces.

Despite the presence of U.S.-led foreign forces training, advising and assisting their Afghan counterparts 17 years after the U.S.-led an invasion to drive them from power, the Taliban controls nearly half of Afghanistan.

Afghan President Ashraf Ghani said last week that 45,000 members of the country’s security forces had been killed since he took office in 2014.

The United States has some 14,000 troops in Afghanistan as part of the NATO-led mission, known as Resolute Support, as well as a U.S. counterterrorism mission directed at groups such as Islamic State and al-Qaeda.

Despite reports last month that the United States was considering pulling out almost half of its forces, a White House spokesman said U.S. President Donald Trump had not issued orders to withdraw the troops. However, the administration has not denied the reports, which have prompted fears of a fresh refugee crisis.

The Taliban sources said other clauses in the draft include an agreement over the exchange and release of prisoners, the removal of an international travel ban on several Taliban leaders by Washington and the prospect of an interim Afghan government after the ceasefire is struck.

The suggestion to appoint an interim government in Afghanistan comes as top politicians including Ghani have filed their nominations for the presidential polls in July. Ghani has repeatedly rejected the offer to agree to the formation of an interim government.

The Taliban sources also confirmed provisions in the draft that have broader implications for Afghanistan’s ties with its neighbors, particularly Pakistan, India and China.

They said the deal included provisions that separatist militants from Balochistan, a resource-rich southwestern Pakistani province, will not be allowed to use Afghan soil to target Pakistan.