A massive explosion rocked central Kabul in a Taliban attack near an international complex. (File photo)

A massive explosion rocked central Kabul late Monday, killing at least five people in a Taliban-claimed attack near an international complex while the US special envoy leading talks with the insurgents visited the Afghan capital.

The blast took place in a residential area near Green Village, a large compound that houses aid agencies and international organisations, interior ministry spokesman Nasrat Rahimi said.

It came while Afghanistan's main TV station Tolo News aired an interview with the US envoy Zalmay Khalilzad, who was discussing a potential deal with the Islamist extremist Taliban that would see the US withdraw forces from five bases across Afghanistan.

Gunfire could be heard in the aftermath of the blast along with a secondary explosion when a nearby petrol station caught fire, sending plumes of smoke into the night sky.

"Five bodies and 50 wounded -- all civilians -- have so far been evacuated from the area," Rahimi said, noting the toll could rise.

Green Village is separate from the nearby Green Zone, a walled-off and heavily fortified part of Kabul that is home to several embassies including the US and British facilities.

Taliban spokesman Zabihullah Mujadid said a coordinated attack with a suicide bomber and gunmen was under way.

Khalilzad, who has spent about a year negotiating with the Taliban, told Tolo the draw-down from US bases would occur within about four months of a final deal being approved -- provided the Taliban stick to their commitments.

The prospective deal centres on US troop reductions in return for several security guarantees from the Taliban, as well as broader peace talks between the insurgents and the Afghan government and an eventual ceasefire.

"We have agreed that if the conditions proceed according to the agreement, we will leave within 135 days five bases in which we are present now," the Afghan-born US envoy said in Dari.

But even as negotiations for an accord between the US and the Taliban have entered what is widely considered to be the final stages, violence has surged across Afghanistan.

On Saturday, the Taliban attempted to seize Kunduz in the north, and on Sunday, they launched an operation in the city of Pul-e Khumri, the capital of neighbouring Baghlan province.

"Threshold" of a deal

Khalilzad was in Kabul following the latest round of talks with the Taliban in Doha, Qatar, after which he said the two sides were at the "threshold" of a deal.

He met Monday with Afghan President Ashraf Ghani and showed him the draft of a proposed agreement.

Even if many of the 13,000 or so US troops in Afghanistan leave soon after a final deal, President Donald Trump last week said America would maintain a permanent presence -- with 8,600 troops initially.

Khalilzad's discussions with Ghani are key because the Afghan government has until now been largely sidelined from talks, though any eventual deal would require the Taliban to talk to the Afghan leader.

"The efforts of the US and other partners will yield results when the Taliban enters direct negotiations with the Afghan government," Ghani's spokesman Sediq Sediqqi told reporters.

Afghanistan's Chief Executive Abdullah Abdullah said in a statement that he too had been briefed and assured of "a thorough and sustainable peace in Afghanistan".

Ghani has appointed a 15-member delegation to meet with the Taliban at "intra-Afghan" talks slated to take place in Norway in the coming weeks.

On Sunday, Khalilzad said the US and the Taliban were closing in on a deal that would reduce violence and pave the way for "sustainable" peace.

Afghan officials said Pul-e Khumri had now been cleared of Taliban insurgents and fighting restricted to the outskirts.

In Kunduz, Afghan forces backed by local and US air power were able to stop the city falling and repel the Taliban, who briefly seized the provincial capital in 2015.

Afghan officials claimed the city was back to normal but Monday afternoon a suicide bomber detonated himself near a security-forces base in the outskirts of Kunduz, killing six troops and wounding 15 other people.

The Taliban claimed responsibility.

US Secretary of State Mike Pompeo has previously said he hoped a peace deal would be finalised before September 1, ahead of Afghan polls set for September 28 despite doubts among many Afghans as to whether they will take place.

Suhail Shaheen, the Taliban's spokesman in Doha, said Saturday a deal was "near to finalised" but did not specify what obstacles remain.