The Islamic State group once drew recruits from near and far with promises of paradise but now bodies of jihadists lie in mass graves or at the mercy of wild dogs as its "caliphate" collapses.

Flies buzz around human remains poking through the dusty earth in the Iraqi town of Dhuluiyah, 90 kilometres (55 miles) north of Baghdad, at a hastily-dug pit containing the bodies of dozens of IS fighters killed in 2015.

"They should have ended up in the stomachs of stray dogs," local police officer Mohammed al-Juburi told AFP.

"We buried them here not out of love but because we wanted to avoid diseases."

At one stage, IS ruthlessly wielded power over a vast swathe of territory straddling Iraq and Syria, but a military onslaught on multiple fronts has seen its fiefdom shrink to a last few pockets.

Since the launch in 2014 of air strikes in Iraq and Syria against the group, a US-led coalition says around 80,000 jihadists have been killed.

The overall number of dead is higher if you include those targeted by Russian and Syrian strikes.

Buried with bulldozers

In agricultural Dhuluiyah on the banks of the Tigris river, residents faced a common dilemma over what to do with the corpses of IS fighters after local Sunni militiamen beat back the jihadists in fierce clashes.

"We could have thrown them into the water, but we love the river too much to pollute it," said the local policeman, who lost his own brother in the violence.

"The people here as well as their animals drink from the Tigris."

Local finally decided to dig a mass grave for the fighters -- but they said they refused to honor them with Islamic rites.

Iraqis visit the grave of a relative, who was killed during battles with Islamic State (IS) group fighters, at a graveyard in the Iraqi town of Dhuluiyah, 90 kilometres (55 miles) north of Baghdad, on Oct. 10, 2017. The Islamic State group once drew recruits from near and far with promises of paradise but now bodies of jihadists lie in mass graves or at the mercy of wild dogs as its (Agence France-Presse/Sabah Arar)

"We buried them with bulldozers. Even in the ground they are still mired in their own filth," said farmer Shalan al-Juburi.

"They said that they would go to paradise to enjoy the gardens of delights, but this is how they ended up."

The desolate site is in stark contrast to a nearby graveyard surrounded by a red-brick wall a few hundred metres (yards) away.

There the "martyrs" who died helping to stop the jihadist advance lie in well-tended tombs adorned with their portraits and shaded by trees.

Elsewhere, in western Iraq's Anbar province, the luckiest among the IS dead appear to be those killed during its offensives against the army in 2015.

In the centre of Fallujah, the first major city captured by the group in 2014, hundreds of memorials in a makeshift cemetery bear the noms de guerre of foreign fighters buried by their comrades.

But as Iraqi forces in Anbar now look to oust the jihadists from their final footholds, operation commander Mahmoud al-Fellahi insisted any jihadists killed will end up in mass graves.

A similar fate befell IS members in the city of Mosul, the group's largest urban stronghold in Iraq that it lost in July.

There, a senior Iraqi commander told AFP, authorities used earthmoving equipment "to bury the jihadists after we collected information on their identities and nationalities".

'Desert dogs are waiting'

Across the border in Syria -- where competing Russia and US-backed offensives are squeezing IS -- the Britain-based Syrian Observatory for Human Rights estimates some 50,000 IS members have been killed.

As clashes rage with the jihadists, one Syrian commander said that what happens to dead fighters is not a priority.

"At the moment, we are more interested in what happens above the ground than under it," he told AFP.

Another military source said the identities of the fighters can provide useful intelligence.

"The terrorists try to collect their dead. If we find them, we try to identify the foreigners for a possible information swap with their home countries," the source said.

In the desert plains that the jihadists once dominated, the bodies of dead fighters are left abandoned, a pro-regime militia head told AFP.

"The desert dogs are waiting for them," he said. "When fighting ends, the jihadists come out of their hiding places to collect the remains."

A spokesman for the US-backed force close to ousting IS from the city of Raqa said the bodies of the group's members were "generally buried" whenever possible.

"But sometimes due to snipers or because they are under rubble, some of the bodies end up rotting," said Syrian Defence Forces representative Mustefa Bali.

While the rank-and-file are often left forgotten, IS appears to have taken care to hide the final resting places of prominent Western jihadists.

"Figures who were well-known and wanted by the international community are buried at secret locations," said Syrian Observatory head Rami Abdel Rahman.

Those include notorious British executioner Mohamed Emwazi, known as "Jihadi John", propaganda chief Abu Muhammad al-Adnani and military leader Omar al-Shishani.

There has been no record of bodies of foreign jihadists being repatriated, said Abdel Rahman.