Sayed Mohammad Amin Fatemi, the public health minister, said: "At this time I can tell you that 31, almost all of them military personnel, have been martyred."

Fatemi also said that 17 of the wounded were in a critical condition.

The attacker detonated explosives strapped to his body as he approached the bus, the ministry said in a statement. 

The attack is the deadliest in the city since an explosion on a police bus in June that killed as many as 35 people.

Carnage

Mohammad Zaher, a witness who had cuts to his forehead from flying glass, said: "The explosion happened just after a group of Afghan National Army soldiers got on to the bus."

Mohammad Azim, a police officer at the scene, said: "For 10 or 15 seconds, it was like an atom bomb - fire, smoke and dust everywhere," Azim said.

Sulahdin, an army officer at the scene who goes by one name, said there were more than 50 people on the bus at the time of the explosion.

Television pictures had showed the bodies of men who appeared to be Afghan national army soldiers being pulled from the wreckage.

Some of the dead were still in their seats.

Month of 'operations' 

Zabihullah Mujahed, a Taliban spokesman, said the attack was part of a Taliban "operation" for the holy month of Ramadan.

There have been more than 100 suicide attacks in Afghanistan this year, many blamed on the Taliban.

While most attacks occur in remote areas in the south and east of Afghanistan, there have been a series of blasts inside Kabul this year.

This attack was the first inside the heavily patrolled capital since a suicide bomb struck a Nato armoured vehicle on September 21, killing a French soldier and wounding several Afghans.