A suicide bomber has attacked an Afghan miltiary convoy outside Kabul killing almost 40 people.

A police offical said at least 37 people had been killed and more than 40 others had been injured after three buses full of police cadets were attacked as they approached the city from neighbouring Wardak province.

The unnamed official said: “Initial information we have is that two suicide bombers were involved and there are many casualties.”

The attack took place 20km west of the Afghan capital, Kabul, according to Mousa Rahmati, the district governor of Paghman.

The Taliban spokesman Zabiullah Mujahid claimed responsibility for the attack and said it was the work of two suicide bombers.

He said the first attacker, on foot, targeted the bus carrying the trainee policemen and their instructors then the suicide car bomber struck 20 minutes later – targetting those who had arrived at the scene to help.

Mr Rahmati said four civilians were among the dead.

At least 37 people have been killed in the attack (Reuters)

A spokesman for the Interior Ministry confirmed the location of the attack and said a loud explosion had been reported, but did not have any further details on the incident.

It comes just over a week after a similar attack on a bus carrying Nepalese security guards working for the Canadian Embassy which killed 14 people in the capital.

The country suffered its deadliest assault since 2011 in April after at least 64 people were killed in a Taliban attack on a security services facility.

Taliban attacks Kabul security compound - in pictures Show all 7 1 /7 Taliban attacks Kabul security compound - in pictures Taliban attacks Kabul security compound - in pictures Kabul attack An relative of one of the victims who was killed in a suicide bomb blast in Kabul, Afghanistan, 19 April 2016. (EPA) EPA Taliban attacks Kabul security compound - in pictures Kabul attack An injured girl is carried to safety following the blast in Kabul (EPA) EPA Taliban attacks Kabul security compound - in pictures Kabul attack A man stands inside his damaged shop near the scene of a bomb blast in Kabul, Afghanistan, 19 April 2016 (EPA) EPA Taliban attacks Kabul security compound - in pictures Kabul attack Afghan quick reaction forces arrive at the site of a suicide car bomb attack in Kabul, Afghanistan April 19, 2016 (Reuters) Reuters Taliban attacks Kabul security compound - in pictures Kabul attack Afghan security forces carry an injured security personnel after a suicide car bomb attack in Kabul, Afghanistan April 19, 2016. (Reuters) Reuters Taliban attacks Kabul security compound - in pictures Kabul attack Afghan security forces inspect the site of a Taliban-claimed attack in Kabul, Afghanistan, April 19, 2016. (AP) AP Taliban attacks Kabul security compound - in pictures Kabul attack Relatives and loved ones carry the coffin of a victim killed in the April 19 Taliban truck bomb attack, at a funeral in Kabul on April 20, 2016. (AFP/Getty Images) AFP/Getty Images

The attacks underline the deadly threat to security in Afghanistan just over a week before a NATO summit in Warsaw where leaders are expected to discuss whether to maintain support for the Kabul government.

Under new leader Mullah Haibatullah Akhundzada, who took over last month after his predecessor, Mullah Akhtar Mansour, was killed in a US drone strike, the Taliban have made it clear that they will continue attacks against the Western-backed government.

Last week, the top UN official in Afghanistan warned of the danger of a new spiral of violence following recent suicide attacks and a spate of highway kidnappings by the Taliban.