Afghan security forces battled gunmen following a suicide attack outside the Iraqi embassy in the capital, Kabul.
A bomber blew himself up at the embassy’s gate, then three other attackers entered the compound, the Afghan interior ministry said.
Two Afghan embassy employees were killed, and three people, including a police officer, were injured, a spokesperson said.
So-called Islamic State (IS) said it carried out the attack.
After a gunfight lasting several hours, Afghan authorities said the attack was over and all the assailants had been killed. The embassy is located in the central Shar-e-Naw neighbourhood. Kabul has seen a number of deadly assaults this year blamed on either IS or the Taliban.