The West should have negotiated with the Taliban more than a decade ago, soon after they were toppled, Britain's senior general in Afghanistan said, after recent efforts to start peace talks collapsed in ignominy.

General Nick Carter told the London-based Guardian newspaper that an opportunity to bring peace to Afghanistan was missed when the Taliban were on the defensive in 2002 after they were ousted following the 9/11 attacks.

"The Taliban were on the run," he said. "At that stage, if we had been very prescient, we might have spotted that a final political solution... would have involved getting all Afghans to sit at the table and talk about their future."

Carter, deputy commander of the NATO-led coalition, acknowledged it was "easy to be wise with the benefit of hindsight" but that Afghanistan's problems were political issues that "are only ever solved by people talking to each other".

The search for a peace settlement with the Taliban is now a priority for the Afghan government and international powers as the insurgency still rages across many parts of the country and US-led troops prepare to exit next year.

A Taliban office in Qatar that opened on June 18 was meant to foster talks but instead triggered a diplomatic bust-up when the insurgents used the title of the "Islamic Emirate of Afghanistan" from their 1996-2001 reign.

President Hamid Karzai, furious that the office was being styled as an embassy for a government-in-exile, broke off separate security talks with the Americans and threatened to boycott any peace process altogether.

US President Barack Obama recently said he anticipated "a lot of bumps in the road" during the peace process but that it was the only way to end the violence in Afghanistan.

More than 3,300 coalition personnel have been killed in Afghanistan since 2001, peaking at 711 deaths in 2010, according to the independent icasualties.org website.

British Prime Minister David Cameron said at the G8 summit 10 days ago that the 12-year military effort in Afghanistan, where Britain still has around 7,900 troops, had to be matched by a "political process".

"That is exactly what I hope can happen with elements of the Taliban," he said.

Only hours after the Qatar office opened, a Taliban rocket attack killed four Americans on the largest military base in Afghanistan. Just days later, a suicide squad targeted the presidential palace and a CIA office, in the most audacious assault in Kabul in years.

The capital's airport, its Supreme Court and an international aid group's compound have also been attacked in recent weeks by heavily-armed Taliban suicide bombers.

"First of all, people like to negotiate from a position of strength, and secondly I think the opponents of Afghanistan would like to appear to compel the international community's withdrawal," Carter said.

"I don't think it's surprising that we are seeing spectacular attacks in Kabul and a continuance of attacks elsewhere."

As NATO troops pull back, Afghan soldiers and police are taking over the fight against the Taliban, who were deposed in 2001 for sheltering Al-Qaeda leaders behind the 9/11 attacks on New York and Washington.

Carter said that Afghan forces had proven themselves in battle and were ready to provide security after 100,000 NATO troops depart by the end of 2014.

"What the opponents of the Afghan government now realise is they are likely to be up against capable Afghan security forces who are going to be here in perpetuity," he said.

"I think that there is every chance people will realise that talking is the answer to this problem."

Peace talks with the Taliban were previously anathema to many Western leaders, with then British Prime Minister Gordon Brown vowing in 2007 that London "will not enter into any negotiations with these people".