KABUL, Afghanistan — More than 28 people were killed and almost 200 injured after militants set off a suicide bomb and stormed a government building in the Afghan capital Tuesday, officials said.
The Taliban claimed responsibility for the attack on the country's main national security agency.
The four-hour assault began when the militants detonated a bus full of explosives outside the the National Directorate of Security compound, an Afghan security source told NBC News on condition of anonymity.
The suicide attack caused a "huge crater outside the compound and has destroyed most of the building," the source said.
At the time there was a ceremony going on inside the compound to mark the competition of a training course for staff and guards at the department, the source added.
"The reason for high casualties is because of the ceremony inside," he said.
Counterterrorism security forces later "pinned down the terrorists" inside one of the buildings, according to Interior Ministry spokesman Sediq Sediqqi, and the last militant was shot dead at 1 p.m. (4:30 a.m. ET) — four hours after the attack began.
Kabul police chief Gen. Abdul Rahman Rahimi told reporters at the scene that 28 people had been killed and 180 wounded. This was far fewer injured than the figure given by the Ministry of Public Health, which put the number of wounded at 327.
The blast struck near the Afghan Ministry of Defense and just a few hundred yards from the Afghan presidential palace and NATO's local headquarters.
Afghan President Ashraf Ghani said in a statement that he "strongly condemns the terrorists' attack in Kabul." He said the incident "clearly shows the enemy's defeat in face-to-face battle with Afghan security forces. It will strengthen our resolve to fight terror."
NATO's U.S.-led Resolute Support mission issued a statement expressing its "deepest condolences to those affected by this contemptible act of violence."
Gen. John W. Nicholson, the U.S. Army commander of the NATO mission said the assault showed that the Taliban was "unable to meet Afghan forces on the battlefield and must resort to these terrorist attacks."
The Taliban, whose Islamist regime was toppled by the U.S.-led invasion in 2001, announced a spring offensive last week.
The militants attacked the northern city of Kunduz over the weekend, resulting in the deaths of around 100 fighters, 16 Afghan security forces and 12 civilians, according to the Ministry of Defense.