KABUL, Afghanistan — Attackers entered the grounds of the Iraqi Embassy in Kabul, the Afghan capital, after a suicide bomber blew himself up at an entrance gate shortly before noon Monday, an Afghan official said.

Two Afghans working at the embassy, a man and a woman, were killed, said Najib Danish, a spokesman for the Ministry of Interior.

Three attackers entered the embassy compound after the bombing around 11:10 a.m., he said. The security forces fought with the attackers for five hours before the attackers were killed. Two soldiers and a police officer were injured, Mr. Danish said.

Image Smoke billowing near the site of the attack in Kabul. A police officer near the scene said five loud blasts were followed by gunfire. Credit... Reuters

A police officer near the scene of the attack said by phone that there were five loud blasts and that gunfire continued afterward. Embassy staff members were evacuated to safety, Mr. Danish said.

“No Iraqi staff are hurt,” he said.

The Islamic State claimed responsibility for the attack through its news agency, Amaq.

The attack was at least the third coordinated assault in the city in recent weeks. Just last week, at least 24 people, including 18 employees of the Ministry of Mines, were killed by a Taliban suicide bomber.

And a month ago, more than 150 people were killed in a truck bombing near the German Embassy that was attributed to the Haqqani wing of the Taliban, though the group denied responsibility. The attack was one of the deadliest in the nearly 16 years since the American-led invasion of Afghanistan.

About 220 people were killed in the first six months of this year in Kabul, the United Nations has said. There were more than 1,000 total casualties over the period, 25 percent more than the same period last year.