At least one civilian died and six were injured in an attack on a Kabul compound belonging to the charity Care International, a spokesman for the Interior Ministry said Tuesday.
Sediq Sediqqi said all three attackers, who took hostages during a siege which lasted 11 hours, had also been killed during the operation to retake the compound.
"Forty-two people including 10 foreigners have been rescued," he said.
Militants had holed themselves up in the Care International building in the centre of Kabul after staging a suicide bombing in front of it late on Monday.
Earlier reports had suggested the militants had targeted a hotel housing mostly Indian nationals.
Afghan security forces began exchanging gunfire with the militants after the suicide bomber attacked just after 11pm local time on Monday, targeting a busy shopping area open late ahead of the Eid holiday.
The attack came after militants carried out two other bombings in Kabul on Monday in which at least another 24 people, including six members of the Afghan security forces, were killed.
Security forces had rushed to the scene of the first attack which came as office workers were returning home for the day. This was followed by another blast when a suicide bomber blew himself up among the crowd that had gathered to assist the injured.
Wahidullah Majroh, a spokesman for the Afghan Ministry of Health, said at least 91 others were injured, and some were in a critical condition.
The Taliban claimed responsibility for the twin bombing, adding that it had killed tens of soldiers and officers in its recent efforts to damage the security elite in Kabul.
Sixteen people were killed last month and 39 others were injured in another Taliban attack on the American University of Afghanistan.
In April, 64 people were killed and more than 300 others were wounded after the Taliban attacked a company providing security for the Afghan elite.
By Mohammad Jawad and Hakim Mukhtar
© 2022 dpa GmbH