Iraqi forces backed by US-led coalition air strikes reached the centre of the western town of Heet, dislodging Islamic State of Iraq and the Levant (ISIL) fighters and evacuating thousands of civilians, state television said on Friday.

A local commander said the pro-government forces had routed ISIL from its stronghold in Heet, which had a prewar population of nearly 100,000, but fighting was still going on.

"We are still pursuing them. They have abandoned their families and fled," the commander said in a live broadcast. "Within days, God willing, Iraqis will rejoice at the complete liberation of Anbar province."

At least 30 Iraqi soldiers were killed and 50 wounded in eight separate ISIL car bomb attacks in Heet, Iraqi military sources told Al Jazeera.

Civilians flee Ramadi as ISIL hits back at Iraqi forces

The recapture of Heet - located on the Euphrates River near Ain al-Asad airbase where several hundred American personnel are training Iraqi army troops - would roll back ISIL further west towards the Syrian border.

Officials in the Iraqi military and the US-led coalition fighting ISIL say that by clearing the town they can build on recent territorial gains in the vast province.

Baghdad has had success in pushing back ISIL in recent months, and has pledged to retake the northern city of Mosul later this year, though an offensive billed as the first phase of that campaign was put on hold this week.

US Secretary of State John Kerry, in Baghdad on a surprise visit, said on Friday the war is being won albeit slowly, and capturing Mosul from ISIL remains the top priority.

"Daesh's days are numbered," Kerry said, using an Arabic acronym for ISIL, also known as ISIS. "We will succeed, and the evidence on the ground suggests that we are in fact doing that now."

ISIL has lost 40 percent of its territory in Iraq, Kerry said. Oil revenue is down by almost a third.

Air strikes on cash storage sites have cost the group millions of dollars, leading rank-and-file fighters to disobey orders, flee positions, and hide among civilians as they've watched their paychecks dwindle and the group lose its aura of invincibility.

Still, attacks against security forces and civilians continue in Iraq, and the hold on territory captured from ISIL remains precarious.

Control of Heet also appeared incomplete and fragile on Friday.

One of the commanders said fighters, who have planted explosives in roads, cars and buildings, had tried to retake a main street but were repelled.

A coalition official said on Sunday as many as 300 ISIL fighters based in Heet had built formidable defensive perimeters.

Iraqi counter-terrorism forces, which have led the military's offensive in Anbar province for months, helped more than 10,000 civilians leave Heet in recent days, the commanders said.

State television broadcast images of men, women and children carrying belongings and waving white flags as they walked out of the town.

ISIL has regularly used civilians as human shields, a tactic aimed at slowing the advance of Iraqi forces and complicating air strikes essential to the ground advance.