Afghan police are killed in what is thought to be a suicide bomb attack.
The blast shattered nearby shop windows in the residential suburb.
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.
Al Jazeera’s Alan Fisher in Kabul reported that the blast was so loud it could be heard across the city.
The attack is the deadliest in the city since an explosion on a police bus in June that killed as many as 35 people.
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.
One witness, Ahmad Jaweed, told Al Jazeera that he saw several corpses belonging to military personnel being removed from the site, along with local residents.
Television pictures had also showed 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 Operation Nasrat (Triumph), a military campaign launched during 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