BAGHDAD (Reuters) - Islamic State has crushed a rebellion plot in Mosul, led by one of the group’s commanders who aimed to switch sides and help deliver the caliphate’s Iraqi capital to government forces, residents and Iraqi security officials said.

Iraqi counterterrorism forces gather on the outskirt of Mosul during preparations to attack Mosul, Iraq, October 14, 2016. REUTERS/Stringer

Islamic State (IS) executed 58 people suspected of taking part in the plot after it was uncovered last week. Residents, who spoke to Reuters from some of the few locations in the city that have phone service, said the plotters were killed by drowning and their bodies were buried in a mass grave in a wasteland on the outskirts of the city.

Among them was a local aide of IS leader Abu Bakr al-Baghdadi, who led the plotters, according to matching accounts given by five residents, by Hisham al-Hashimi, an expert on IS affairs that advises the government in Baghdad and by colonel Ahmed al-Taie, from Mosul’s Nineveh province Operation Command’s military intelligence.

Reuters is not publishing the name of the plot leader to avoid increasing the safety risk for his family, nor the identities of those inside the city who spoke about the plot.

The aim of the plotters was to undermine Islamic State’s defence of Mosul in the upcoming fight, expected to be the biggest battle in Iraq since the 2003 U.S.-led invasion.

Mosul is the last major stronghold of Islamic State in Iraq. With a pre-war population of around 2 million, it is at least five times the size of any other city Islamic State has controlled. Iraqi officials say a massive ground assault could begin this month, backed by U.S. air power, Kurdish security forces and Shi’ite and Sunni irregular units.

A successful offensive would effectively destroy the Iraqi half of the caliphate that the group declared when it swept through northern Iraq in 2014. But the United Nations says it could also create the biggest humanitarian crisis in the world, in a worst case scenario uprooting 1 million people.

Islamic State fighters are dug in to defend the city, and have a history of using civilians as human shields when defending territory.

Slideshow ( 5 images )

CAUGHT

According to Hashimi, the dissidents were arrested after one of them was caught with a message on his phone mentioning a transfer of weapons. He confessed during interrogation that weapons were being hidden in three locations, to be used in a rebellion to support the Iraqi army when it closes in on Mosul.

IS raided the three houses used to hide the weapons on Oct. 4, Hashimi said.

“Those were Daesh members who turned against the group in Mosul,” said Iraqi Counter-terrorism Service spokesman Sabah al-Numani in Baghdad, using an Arabic acronym for Islamic State. “This is a clear sign that the terrorist organisation has started to lose support not only from the population, but even from its own members.”

A spokesman for the U.S.-led military coalition which conducts air strikes on Islamic State targets in Syria and Iraq was unable to confirm or deny the accounts of the thwarted plot.

Signs of cracks inside the “caliphate” appeared this year as the ultra-hardline Sunni group was forced out of half the territory it overran two years ago in northern and western Iraq.

Some people in Mosul have been expressing their refusal of IS’s harsh rules by spray-painting the letter M, for the Arabic word that means resistance, on city walls, or “wanted” on houses of its militants. Such activity is punished by death.

Numani said his service has succeeded in the past two months in opening contact channels with “operatives” who began communicating intelligence that helped conduct air strikes on the insurgents’ command centres and locations in Mosul.

A list with the names of the 58 executed plotters was given to a hospital to inform their families but their bodies were not returned, the residents said.

“Some of the executed relatives sent old women to ask about the bodies. Daesh rebuked them and told them no bodies, no graves, those traitors are apostates and it is forbidden to bury them in Muslim cemeteries,” said one resident whose relative was among those executed.

“After the failed coup, Daesh withdrew the special identity cards it issued for its local commanders, to prevent them from fleeing Mosul with their families,” Colonel al-Taie said.

A Mosul resident said Islamic State had appointed a new official, Muhsin Abdul Kareem Oghlu, a leader of a sniper unit with a reputation as a die-hard, to assist its governor of Mosul, Ahmed Khalaf Agab al-Jabouri, in keeping control.

Islamic State militants have placed booby traps across the city of Mosul, dug tunnels and recruited children as spies in anticipation of the offensive.