The siege on a Kabul hotel, popular among Chinese visitors, was brought under control about three hours after gunmen stormed the building on Monday afternoon.
The Taliban said late Monday that three gunmen had been killed.
The Longan Hotel, which came under siege, is especially popular among Chinese visitors and is located in Shar-e-Naw in downtown Kabul.
The Taliban also confirmed that two foreigners were injured when they tried to escape from a hotel window.
Kabul’s Emergency Hospital, run by an Italian non-profit just one kilometer from the hotel, reported however that they received 21 casualties – 18 injured and three dead on arrival.
Videos posted on Twitter by a journalist in Kabul and verified by Reuters showed smoke billowing out of one of the floors amid sounds of gunshots, while a person was seen trying to escape the attack by jumping out of a hotel window.
The attack started at about 2.30 pm with an explosion, followed by gunfire, eyewitnesses reported.
The Taliban has not yet released further details nor has the group released the nationalities of the foreigners injured. However, China’s state-run Xinhua news agency said the attack happened near a Chinese guesthouse and its embassy in Kabul was closely monitoring the situation.
Several bombings have taken place in Afghanistan in recent months, including an attack on the Pakistan embassy earlier this month and a suicide blast near the Russian embassy in September. Both attacks were claimed by the Islamic State.
In the Russian embassy attack, two diplomatic staff members and four Afghan citizens were killed.
While no confirmation has been received on reports that Chinese nationals were in the Longan hotel at the time of the attack, the siege came a day after China’s ambassador to Kabul Wang Yu met with Sher Mohammad Abbas Stanikzai, the Taliban’s deputy foreign minister, over safety concerns.
The meeting took place on Sunday where Wang asked for security on his embassy to be “beefed up”.
So far, no group has claimed responsibility for Monday’s hotel attack.