Iraqi officials say troops and Shiite militiamen have repelled an Islamic State group attack that left 10 soldiers dead in Anbar province.

Anbar councilman Athal al-Fahdawi said militants attacked the government-held town of Khalidiyah early Friday with mortars and five suicide car bombs.

He said the attackers retreated after an hours-long battle, leaving behind 12 dead fighters.

Police and army officers said at least 10 soldiers were killed. They spoke on condition of anonymity because they are not authorized to speak to the media.

Iraqi forces, backed by Shiite militias, have been struggling to recapture areas lost to the IS group in the country's west and north. In May, the militant group scored a stunning victory, overrunning Ramadi, the provincial capital of Anbar.