Afghan National Army base in Maidan Wardak province, Afghanistan. (Reuters)

US and Taliban negotiators moved closer Tuesday to a deal, the insurgent group said, as Secretary of State Mike Pompeo voiced guarded hope for a deal under which Washington will withdraw large numbers of troops from Afghanistan.

The optimism came during the fifth day of talks in Qatar between the two sides as negotiators wrangled over individual words and phrases in a draft deal.

"We have progress in this round so we are finalising the remaining points," Taliban spokesman Suhail Shaheen told journalists outside the upmarket Doha members' club where the talks are taking place.

He said a deal could be expected "as soon as the remaining points are finalised".

The United States invaded Afghanistan in 2001 after the September 11 attacks, toppling the Taliban from power.

Washington wants to withdraw thousands of US troops and bring an end to 18 years of war -- but only on the condition that the group renounces its connections to Al-Qaeda and curbs attacks.

Pompeo, addressing US war veterans, said while he could not predict how the talks would end, President Donald Trump "is committed to make sure that we get it right."

"His clear guidance to me and to my military colleagues is this -- we want to get our folks home as fast and in as large numbers as we can, and we want to make sure that never again is terror struck on the United States," Pompeo said.

"So I believe we can and will accomplish both of these, and we will honour your labours and your sacrifices in this fight," he told the American Legion's national convention in Indianapolis.

Violence persists

The Doha negotiations -- the ninth round between the United States and the Taliban -- are being held against a backdrop of persistent violence in Afghanistan.

The Taliban claimed on Saturday to have killed seven members of the US military in an attack on a convoy near Bagram airfield north of Kabul.

American officials dismissed the claims as "lies".

On Wednesday, two US soldiers were killed by small arms fire in Faryab province in northern Afghanistan, the Pentagon said.

Shaheen had said the deaths should have a "positive" impact on talks in Doha.

Chief US negotiator Zalmay Khalilzad tweeted Monday that Washington would "defend Afghan forces now and after any agreement" with the group.

He was responding to suggestions a deal might not apply to the insurgents' fight against the US-backed Afghan government.

He also wrote that all sides in the negotiations had agreed "Afghanistan's future will be determined in intra-Afghan negotiations".

Shaheen said "all internal issues" would be discussed in inter-Afghan talks after the Doha agreement is completed and made public.

Washington is hoping to strike such a deal by September 1 -- ahead of Afghan polls due the same month, and the US presidential election next year.

The four pillars of any Taliban-US deal are expected to be the withdrawal of foreign troops, a ceasefire, counter-terror guarantees and intra-Afghan dialogue.

Any agreement would be announced before the media as well as representatives from neighbouring countries including China, as well as Russia and the United Nations, the Taliban has said.