Isis has claimed responsibility for a suicide bombing and gun attack which targeted the Iraqi Embassy in Kabul.

The attack in the Afghan capital began when a suicide bomber blew himself up outside the embassy gates and another three attackers stormed inside the building from where they battled Afghan security forces.

Isis claimed responsibility for the attack via its Amaq news agency.

The Afghan Inteiror Ministry said the attack was brought to an end with all the attackers killed four hours after the assault began.

A large contingent of Afghan security forces responded to the suicide attack followed by a gunfight with Isis fighters at the Iraqi embassy in Kabul, Afghanistan (AP/Massoud Hossaini)

​The ministry has not released official casualty figures but Najib Danish, a spokesman for the ministry, condemned the attack as "un-Islamic and inhuman."

Mr Danish also said the embassy building suffered extensive damage with windows broken, and several rooms badly burned.

Earlier, the Iraqi foreign ministry said two Afghan guards were killed in the attack and attempts were underway to evacuate two Iraqi embassy staffers.

Smoke can be seen billowing from the area near the Iraqi embassy after witnesses reported hearing a loud explosion (Hamdard/Twitter)

Witnesses reported hearing a loud explosion followed by gunfire and seeing smoke billowing from Share Naw neighbourhood.

The area was surrounded by armoured vehicles and a large contingent of police and Afghan soldiers.

More than an hour later, witnesses reported hearing another powerful explosion and saw black smoke billowing skyward.

It wasn't immediately clear what had caused the last explosion.

Smoke rises from the area near the Iraqi embassy (Muslim Shirzad/Twitter)

At least one eyewitness, a store owner who goes by the name of Hafizullah (many Afghans use only one name) told the Associated Press he saw the bodies of two policemen on the ground before armoured personnel carriers and police arrived to cordon off the area.

"The explosion was so strong. I was so afraid," said Maryam, a woman crying near the site of the attack said.

An Afghan policeman sets up a perimeter at the site of the explosion in Kabul (AFP)

After Iraqi forces, backed by a US-led coalition, recaptured the city of Mosul from Isis earlier in July, the Iraq Embassy had called reporters to its offices in Kabul to express concerns that the local Isis affiliate might stage large-scale attacks elsewhere to draw away attention from the militant group's losses in Iraq.

The Iraq Embassy is located in a part of the city known as Shahre Naw, which lies outside the so-called "green zone" where most foreign embassies and diplomatic missions are located and which is heavily fortified with a phalanx of guards and giant cement blast walls.

By comparison, the Iraqi Embassy is located on a small street in a neighbourhood dominated by markets and businesses.

Protesters demand better security in Kabul Show all 10 1 /10 Protesters demand better security in Kabul Protesters demand better security in Kabul A woman tries to stop police from firing on protesters during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. AP Protesters demand better security in Kabul Afghan security officials use a water cannon to disperse demonstrators as they protest against a suicide bomb attack in Kabul, Afghanistan, 02 June 2017. At least 90 people were killed and more than 350 wounded in a suicide bomb attack near the foreign embassies in Kabul on 31 May. AP Protesters demand better security in Kabul A policeman rests during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. AP Protesters demand better security in Kabul Protesters shout anti government slogans during a demonstration to protest against the lack of security in Kabul, Afghanistan, Friday, Jun 2, 2017. Some 500 people are demonstrating in Kabul for better security in the Afghan capital in the wake of a powerful truck bomb attack that killed 90 people. AP Protesters demand better security in Kabul Police forces run as protesters throw stones during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. AP Protesters demand better security in Kabul Protesters shout anti government slogans during a demonstration to protest against the lack of security in Kabul, Afghanistan, Friday, Jun 2, 2017. Some 500 people are demonstrating in Kabul for better security in the Afghan capital in the wake of a powerful truck bomb attack that killed 90 people. AP Protesters demand better security in Kabul Protesters throw stones toward security forces during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. ( AP Protesters demand better security in Kabul Police forces run as protesters throw stones during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. AP Protesters demand better security in Kabul Protesters throw stones toward security forces during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. AP Protesters demand better security in Kabul A boy walks past protesters during a demonstration in Kabul, Afghanistan, Friday, June 2, 2017. Hundreds of demonstrators demanded better security in the Afghan capital in the wake of a powerful truck bomb attack that killed scores of people. AP