BAGHDAD (Reuters) - Islamic State militants holed up west of Baghdad launched their biggest attack on Iraqi troops in months on Wednesday, security sources said, killing at least seven soldiers before being forced to retreat.

The fighting, near the city of Ramadi in Anbar province, continued for several hours after the militants attacked with suicide car bombs, mortars and machine guns, the sources said.

Bolstered by reinforcements, Iraqi forces killed 16 militants, state TV said, citing military commanders. Warplanes chased those who fled, it said.

According to a preliminary toll from security sources, the attack killed at least seven soldiers and wounded 16, making it one of the biggest since government troops recaptured Ramadi from Islamic State in December 2015.

A low-intensity guerrilla war has continued in the region.

The jihadist group remains in control of a pocket north of Baghdad, Hawija, and a stretch of land across the Syrian-Iraqi border, where Iraqi forces launched offensives this month supported by a U.S.-led international coalition.

The “caliphate” that Islamic State declared over parts of Iraq and Syria effectively collapsed in July, when Iraqi forces captured its de facto capital Mosul.