The US and the Taliban are on the brink of striking a deal after 18 years of war, Washington's top negotiator said Sunday, ahead of a visit to Afghanistan where fresh violence rocked the north.
The apparent progress at the latest round of talks to conclude in Doha came even as the Taliban launched a broad offensive on the city of Kunduz in northern Afghanistan, and violence flared in a neighbouring province.
"We are at the threshold of an agreement that will reduce violence and open the door for Afghans to sit together to negotiate an honourable and sustainable peace," tweeted Washington's special envoy to Afghanistan, Zalmay Khalilzad, who was scheduled to arrive in Kabul on Sunday to discuss developments with Afghan officials.
His comment came just hours after Afghan security forces said they had cleared Kunduz of Taliban fighters, who on Saturday launched a broad assault on the provincial capital in a bid to score a repeat of a 2015 takeover.
Afghan forces, backed by local and US air power, were able to stop the city falling and repel the Taliban, but 20 troops and five civilians were killed, officials said.
The brazenness of the assault was highlighted by a suicide bomber blowing himself up and killing police spokesman Sayed Sarwar Hussaini as he briefed reporters on the fighting.
At least 10 others were also killed, officials said.
In 2015 the Taliban overwhelmed local forces and briefly seized Kunduz, and it was only retaken by Afghan forces with US air support.
Intense fighting also broke out Sunday in Pul-e Khumri, the capital of neighbouring Baghlan province, but officials said the situation was "under control".
Meanwhile in the northern province of Balkh, the governor's spokesman Munir Ahmad Farhad said eight civilians were killed when their car hit a Taliban mine.
US Secretary of State Mike Pompeo has previously said he hoped a peace deal would be finalised before 1 September, ahead of Afghan polls due 28 September.
Suhail Shaheen, the Taliban's spokesman in Doha, said Saturday a deal was "near to finalised" but did not specify what obstacles remain.
Afghan-born Khalilzad, who previously served as the US ambassador to Kabul, has spent the last year or so criss-crossing the globe in a bid to build support for a historic deal with the Taliban.
While the agreement would not immediately assure peace, it is designed to lead to a drop in violence.
The agreement will centre on the US beginning to withdraw approximately 13,000 troops in exchange for a Taliban guarantee that Afghanistan will not be used as a jihadist safe haven.
Negotiations between the Taliban and the Afghan government, and an eventual ceasefire, will also be key pillars of any deal.
The deal would pave the way to "a unified, sovereign Afghanistan that does not threaten the United States, its allies, or any other country", Khalilzad said.
He did not say if he had a finalised text to show Afghan authorities, but several officials have hinted in recent days that moving talks to Kabul could signal a positive outcome.
The apparent final phase of talks follows an excruciating few months for Afghans.
The war-torn nation's people have watched on largely voiceless as US negotiators cut a deal with the Taliban while largely sidelining the government of President Ashraf Ghani.
Fearing a return to power of the hardline Taliban, many worry the deal and subsequent negotiations will lead to a reduction in personal freedoms and limited women's rights that modern Afghans have grown accustomed to.
US troops were first sent to Afghanistan after the 11 September 2001 attacks carried out by Al-Qaeda, which was sheltered by the former Taliban regime.
Washington now wants to end its military involvement -- the longest in its history -- and has been talking to the Taliban since at least 2018.