The Taliban claimed responsibility for a truck bomb attack on a military and logistics services compound, mainly used by foreigners, in Kabul early on Monday after a powerful explosion was heard all around the city.
However, casualties appear to have been limited despite the unusually loud blast from the explosion at about 1.30 a.m. local time (2100 GMT Sunday).
Kabul police chief Abdul Rahman Rahimi said the incident ended with one attacker killed when his vehicle detonated and two other attackers killed by police. One police officer was killed and four were wounded.
As day broke, gunfire and occasional explosions rang out over the industrial zone where security forces had taken up positions near the Northgate Hotel, a secure residential compound for foreign military and civilian organizations.
The attack on a hotel the Taliban said was a "place of vulgarity and profanity" was the latest in a series against foreign targets in Kabul, underlining precarious security in Afghanistan, even in the capital.
It came around a week after the Islamic State militant group claimed responsibility for a suicide attack on a demonstration by members of the mainly Shi'ite Hazara minority, killing at least 80 people.
The Taliban, who say that foreign "invaders" must leave Afghanistan but who often say they want to avoid civilian casualties, said the compound was not near homes and that ordinary people were not harmed.
Security officials originally said four attackers were at the site, a walled compound of a type typically used by foreign security and civilian organizations in Kabul, even though police later said that only three attackers had been killed.
The Taliban claimed there were "dozens of dead and wounded". The Islamist group often exaggerates the extent of attacks it launches against Afghan government and foreign security targets.
After the attack, Afghan security forces closed off streets around the site, which is east of Kabul's main international airport and on the way to the sprawling Bagram air base north of the capital.
Columns of vehicles carrying troops and police were in the area and heavy automatic gunfire could be heard, along with rocket-propelled grenades fired by Afghan security forces.
There were also widespread reports of power outages in Kabul after the blast, with electricity cut off in several areas of the city.
The attack followed the bombing of a busload of Nepalese security contractors who worked for the Canadian embassy in June, as well as other attacks on foreigners in Kabul, including a suicide attack on Camp Baron, a camp used by foreign contractors in January.