An attack on the Iraqi embassy in Kabul has reinforced fears that Islamic State militants are seeking to bring the group's Middle East conflict to Afghanistan, though evidence of fighters relocating from Iraq and Syria remains elusive.

Islamic State said it carried out Monday’s attack, which began with a suicide bomber blowing himself up at the embassy’s main gate, allowing gunmen to enter the building and battle security forces.

The choice of target, three weeks after the fall of Mosul to Iraqi troops, appeared to back up repeated warnings from Afghan security officials that, as Islamic State fighters were pushed out of Syria and Iraq, they risked showing up in Afghanistan.

“This year we’re seeing more new weapons in the hands of the insurgents and an increase in numbers of foreign fighters,” said Afghan Defence Ministry spokesman Gen. Dawlat Waziri. “They are used in front lines because they are war veterans.”

One senior security official put the number of foreigners fighting for both Islamic State and the Taliban in Afghanistan at roughly 7,000, most operating across the border from their home countries of Pakistan, Uzbekistan or Tajikistan, but also including others from countries such as India.

While such foreign fighters have long been present in Afghanistan, there has been growing concern that militants from Arab countries, who have left the fighting in Syria as pressure on Islamic State there has grown, have also been arriving in Afghanistan.

“We are not talking about a simple militant fighter, we are talking about battle-hardened, educated and professional fighters in the thousands,” another security official said.

“They are more dangerous because they can and will easily recruit fighters and foot soldiers here.”

The United States, which first came to Afghanistan in 2001 after Al Qaeda’s attacks on New York and Washington, is considering sending more troops to Afghanistan, in part to ensure the country does not become a haven for foreign militant groups.

But while Afghan and U.S. officials have long warned of the risk that foreign fighters from Syria could move over to Afghanistan, there has been considerable scepticism over how many have actually done so.

In April, during a visit to Kabul by U.S. Defense Secretary James Mattis, the commander of NATO forces in Afghanistan, Gen. John Nicholson, said that, while ISIS had an “aspiration” to bring in fighters from Syria, “we haven’t seen it happen”.