Militant group Islamic State has claimed responsibility for an attack on the Iraqi embassy in Kabul that began with a suicide bomber blowing himself up at the main gate, allowing gunmen to enter the building and battle security forces.
Although there has been no confirmation of direct planning links with the main Islamic State movement in Iraq and Syria, the attack, just three weeks after the recapture of Mosul, underlines fears of a spillover into Afghanistan from fighting in Syria and Iraq.
Afghan security forces confronted three gunmen for hours before the Interior Ministry announced in mid-afternoon that the attack, in a normally busy business district of the capital, had been suppressed.
- Islamic State's brutal training regime for young children
- Urgent investigation after foiled Sydney terror threat
"The attack is finished," said Sayed Basir, a member of the special forces unit that dealt with the incident.
He said the four attackers were dead, while two members of his unit were slightly wounded.
The embassy building, partly blackened by smoke and flames from the fighting, was damaged but otherwise the impact from the Monday attack was relatively limited, compared with other recent attacks in Kabul.
Najib Danish, an Interior Ministry spokesman, said two Afghan embassy workers had been killed but no Iraqi personnel had been hurt.
A separate statement from the Iraqi Foreign Ministry said an Iraqi diplomat had been rescued, while a nearby hospital operated by Italian aid group Emergency said two injured people had been brought in for treatment.
Islamic State's Amaq agency said two attackers carrying machine guns and hand grenades and wearing suicide vests had blown up the gate, and two fighters had broken into the compound.
It said more than 27 guards had been killed, well above the figures given by Afghan authorities.
The assault came a week after 35 people were killed in a Taliban attack on government workers in Kabul and underlines Afghanistan's precarious security.
Islamic State, an ultra-hardline Sunni group, has carried out a series of high- profile attacks in Kabul, mainly targeting members of the mainly Shi'ite Hazara community.
The top US commander in Afghanistan, General John Nicholson, condemned the attack.
"ISIS-K seeks only to destroy a peaceful future for the people of Afghanistan.
They failed in this attack and they will be defeated," he said in a statement.