Two Afghan workers for the Iraqi Embassy in Kabul were killed Monday after gunmen launched an attack, officials said.
Najib Danish, a spokesman for the Afghan Interior Ministry, also said three police officers were wounded.
Danish said a suicide bomber blew up the gates at about 11:30 a.m.
Three gunmen entered the embassy's grounds and began firing.
Afghan special forces were called in to engage the attackers, killing all of them after a battle lasting more than four hours.
Iraqi diplomats were taken to a safe place, Danish said, and none of them were injured.
The gunbattle is just the latest attack in Kabul in recent months, after two deadly bombings in May and July left almost 200 people dead.
In May, a blast in Kabul's diplomatic quarter killed at least 150 people, tearing through rush-hour traffic and injuring hundreds of people, including children. Two months later, in July, at least 31 people were left dead after a car bombing claimed by the Taliban.