The Islamic State (IS) group on Sunday claimed an attack which killed at least two US soldiers in northern Iraq.

IS militants fired Grad rockets on American troops east of Tal Afar, a town still under control of the militants west of Mosul, according to an online statement from the group.

Isis claims the 2 American soldiers were killed in east Tal Afar near a water plant in village of Bewer #Iraq #Mosulhttps://t.co/AtOEITig9W pic.twitter.com/VCJ3uKyaln — Fazel Hawramy (@FazelHawramy) August 13, 2017

The statement claimed four soldiers had been killed.

However, on Monday, a Pentagon official said a US Army artillery "mishap" was responsible for the deaths of the two service members.

"An Army artillery section was conducting a counterfire mission against an ISIS mortar site when a mishap occurred, injuring seven soldiers," Pentagon spokesman Colonel Robert Manning said, using an acronym for the Islamic State.

The American military had said earlier that two US service members had been killed and five injured during "combat operations".

The US military had said the incident was under investigation, adding that it was unlikely that the deaths were due to enemy contact.

"The entire counter-IS Coalition sends our deepest condolences to these heroes' families, friends and teammates," said Stephen Townsend, a lieutenant general in command of Operation Inherent Resolve in Iraq.

"I hope there is some small solace in knowing their loss has meaning for our country and all the nations of the coalition as the fallen service members were fighting to defeat a truly evil enemy and to protect our homelands."

The self-proclaimed "caliphate" of IS effectively collapsed last month, when US-backed Iraqi forces completed the recapture of Mosul, the militants' capital in Iraq, after a nine-month campaign.