Baghdad: Disguised as Iraqi army soldiers, a squad of Islamic State militants attempted to bomb a base in western Iraq where hundreds of United States troops are stationed, raising concerns about whether the Americans will be drawn into direct combat with the extremists.

Iraqi security forces supported by "surveillance assets" from the US-led coalition against the Islamic State killed eight militants who tried to carry out a "direct attack" on the Ayn al-Asad air base in Iraq's Anbar province at 7:20am, the Combined Joint Task Force said in a statement. The men were would-be suicide bombers who sought to enter the base disguised as Iraqi army soldiers, said Sulaiman al-Kubaisi, a spokesman for Anbar's provincial council.

Three of the militants reportedly were able to set off their explosives, before the rest were killed.

The attack came a day after militants took control of most of al-Baghdadi, a town less than seven kilometres from the base, where 320 US service members have been training Iraqi troops and tribal fighters.

US forces were "several kilometres" from the attack and were at no stage under direct threat, the statement said. Still, the targeting of a base hosting US troops underscored the risk that Americans could be drawn into real engagement with the militants.