A suicide bomber blew himself up inside the Afghan Ministry of Information and Culture on Thursday, killing at least five people, officials and witnesses said. The Taliban claimed responsibility.
The Islamist militant group said foreign advisers in the ministry were the targets of the attack.
Zabiullah Mujahid, a Taliban spokesman, said three militants stormed the building by throwing hand grenades at the guards at the main gate. One carried out the suicide attack and the other two fled, he said.
It was impossible to immediately verify the details of Mujahid's claim.
Five people were killed in the attack, according to a statement from President Hamid Karzai's office. Another 21 were wounded in the explosion, said Abdul Fahim, the spokesman for the Health Ministry, which supervises the hospitals where the injured were taken.
One of the walls of the building collapsed. Glass littered the roads nearby and office equipment was scattered over the area.
Ministry workers were helped out of the building by security personnel and ambulances carried the wounded to hospitals.
Thursday's attack was the latest episode in escalating violence in Afghanistan this year, which has marked the bloodiest period since the Taliban's ouster in 2001.
While the insurgents regularly use suicide attacks against Afghan and foreign forces around the country, suicide attacks have been rare in Kabul in recent months.
On July 7, a suicide bomber detonated his explosives outside the gates of the Indian Embassy in Kabul, killing more than 60 people and wounding 146.
Thursday's attack comes despite recent proposals for talks with the Taliban.
It echoed growing frustration among many Afghans about insecurity, rampant corruption, lack of the rule of law and civilian casualties caused by foreign troops in strikes against the militants.
The Taliban have ruled out talks until foreign troops, led by the U.S. military and NATO, leave Afghanistan.