At least 34 people were killed and more than 100 wounded, including national football players and children, when a powerful explosion tore through central Kabul, sending smoke billowing into the sky.
Some 50 students were injured in the blast, the education ministry said. Pictures from the scene show young children still clutching their books and pens as they are taken to hospitals.
The Taliban claimed responsibility for the attack, which was carried out two days after the insurgents began a new round of peace talks with US officials.
Security sources say the blast was caused by a minibus packed with explosives, detonating early on Monday in the Puli Mahmood Khan area, which houses military and government buildings, as the streets were packed with morning commuters.
The attack targeted an Afghan army logistics base and militants stormed the building after the bomb detonated. The country's football federation and a private school were also hit by the blast.
Five militants were killed in a raid by a crisis response team in a counterattack which lasted until the late afternoon, the Interior Ministry spokesman said. The attack is an example of increasingly frequent "complex assaults" in which militants create chaos with an initial blast, then storm a sensitive building, which leads to an hours-long gun battle, extending the bloodshed.
Even once all of the militants were killed, Afghan security forces face the agonising task of clearing the building of explosives left by the Taliban. Police issued a warning to citizens to avoid panicing.
One Taliban member was arrested at the scene and about 200 people were rescued from the Defence Ministry building, the Interior Ministry said.
At least 116 people were wounded, including 26 children and six women, the Health Ministry spokesman Dr Wahidullah Mayar said. The spokesman put the confirmed death toll at one, but ministry officials said at least 34 people were killed.
The explosion also damaged the office of the Afghan Football Federation, injuring several players. Some players were injured by glass and taken to hospitals, the federation said.
There was a heavy police presence in Kabul as security forces secured the city and ambulances took the injured to hospital. Helicopter gunships flew over the site.
Afghanistan's Chief Executive Abdullah Abdullah said the attack showcased the Taliban's "inherent criminal nature", and promised to "pursue and punish the miscreants".
President Ashraf Ghani strongly condemned the attacks, in a message carried by his spokesman, calling it "inhuman and a crime against humanity".
The Taliban spokesman said the target of the attack was a defence ministry logistics centre. Early reports said the blast was near the US Embassy, but the embassy confirmed they were not affected.
"We strongly condemn the Taliban’s latest brutal attack against fellow [Afghans]," the mission said.
The British embassy in Kabul called the attack brutal, and said: "Afghans deserve to live in peace."
Officials from the UN office in Afghanistan gave blood to help the injured children and urged others to do the same.
The attack comes as the Taliban and the United States hold "make-or-break" talks in Qatar, where the militant group maintains a political office.
It is the seventh round of talks between the Taliban and the US special envoy to Afghanistan Zalmay Khalilzad.
President Ghani visited Pakistan last week to build regional co-operation on the peace process. Pakistan's foreign minister promised to support the peace process, while Mr Ghani praised Pakistan’s role in the effort.
Negotiations so far have focused on four issues: counter-terrorism, the foreign troop presence, an intra-Afghan dialogue and a permanent ceasefire.
A key sticking point is the Taliban's refusal to negotiate with the Afghan government, who they see as puppets of the US-led Nato coalition.