MOSUL, Iraq - One informer said he hid the sim card from his mobile phone in a water filter to avoid detection by Islamic State. Another concealed his in a sack of rice and made calls to his Iraqi handlers from a basement.

They were among several hundred Mosul residents who provided information on Islamic State targets during the victorious nine-month battle for Iraq’s second biggest city, Iraqi military and Kurdish intelligence officials said.

They included taxi drivers, Iraqi soldiers and defectors from Islamic State. Without their help, officials say, the fighting would have dragged on longer, snared in Mosul’s narrow alleys.

“I was really afraid the whole time. Because you paid with blood, you paid with your life if you were caught,” said one of the informers, 30-year-old former army sergeant Alaa Abdullah, who remained in Mosul after its capture by Islamic State in 2014.

“My mother used to say, you’re still young. But I’d tell her, every time I see a Daesh fighter, I get a grey hair,” he said, using the Arabic acronym for Islamic State. “And you can see all my greys now. From all that hatred and fear.”

The city, which was home to about two million people before the war, was liberated in July. Islamic State’s reversal seemed improbable in June 2014 when its fighters swept into Mosul. The militants were welcomed by many fellow Sunnis, the majority of the city’s population, who complained of injustices at the hands of Iraq’s Shi’ite led government. The Iraqi army capitulated and fled, leaving its weapons behind.

Mosul was Islamic State’s most significant conquest in Iraq, part of what it called a “caliphate” that stretched into neighbouring Syria. In Mosul’s Great Mosque, Islamic State leader Abu Bakr al-Baghdadi declared himself the head of the world’s Muslims in July 2014.

Yet by the time Iraqi forces launched a massive ground assault to retake Mosul in October 2016, backed by Kurdish fighters, Shi’ite militias and U.S. air power, many residents had turned against the group, which exerted brutal control. Its opponents were beheaded or shot. Acts such as smoking a cigarette were punishable by 40 lashes, residents said.

In interviews with Reuters, nine Iraqi and Kurdish military officials, informers and their relatives detailed how their battle for Mosul unfolded. As Iraqi army commanders and U.S. advisers were preparing the ground offensive, intelligence officers were recruiting informers, building alliances with the region’s Sunni tribes and infiltrating Baghdadi’s inner circle. Iraqi intelligence had tested using informers in the successful operation to retake another Islamic State stronghold, Falluja, in June 2016. Now it was time to apply the tactic on a bigger scale in Mosul.

Reuters couldn’t independently confirm every detail of the informers’ accounts. But key elements supplied by these sources, who mostly didn’t know each other, were consistent.

“We were working hard to penetrate networks and establish connections that would be beneficial once the military phase began, and it paid off,” a senior Kurdish counter-terrorism official, Lahur Talabany, told Reuters. “We were able to connect to people close enough to aid us in our efforts.”

Many people became informers because “they truly believed in the cause of eradicating Islamic State,” Talabany said. A few were motivated by money to put food on the table. Islamic State fighters defected from the militant group when they saw its downfall was “inevitable and imminent.”

Mosul residents interviewed by Reuters pointed to challenges ahead. The people of the city may have rejected Islamic State, but that doesn’t mean they accept Baghdad’s rule, they said. Distrust of the Shi’ite-led government, headed by Prime Minister Haider al-Abadi, runs deep among Mosul’s Sunnis. Some are enviously watching moves by Kurds in northern Iraq towards declaring an independent state.

SADDAM’S MEN

From early 2016, Iraqi military intelligence began reaching out to possible informants and allies through intermediaries, Iraqi officials said.

Intelligence officers first turned to the Sunni tribes that had been instrumental in driving out Islamic State’s precursor, Al Qaeda, in 2006-2007. But fear of Islamic State was holding the tribes back, said Lieutenant Colonel Salah al-Kinani, an army intelligence officer. One tribesman, for instance, wanted a guarantee that Islamic State would not burn him alive if he was caught.

Then, in August 2016, there was a breakthrough.

Kinani and his men made contact with a close aide to Baghdadi, Ali al-Jabouri, also known as Abu Omar al-Jabouri, a former officer in Saddam Hussein’s Republican Guard who had joined Islamic State when it overran Mosul in 2014.

Saddam-era officers had been a powerful factor in the rise of Islamic State, often motivated by a shared hatred of the Shi’ite-led government in Baghdad. But some of these officers, Jabouri among them, had since grown disillusioned with Islamic State’s brutal methods and the growing influence of foreign fighters who had flocked to Mosul.

An Iraqi intelligence officer began negotiating with Jabouri through members of his Jabouri tribe, Kinani said. After initially hesitating, Jabouri agreed to lead 60 men in a revolt against Islamic State to coincide with the start of the army’s ground assault in October 2016. The Iraqi military would supply Jabouri with arms and ammunition. It gave Jabouri and his men assurances that they would not be prosecuted for past crimes.

But the plot failed. Islamic State became suspicious of a fighter loyal to Jabouri, according to Kinani, and seized his mobile phone, which revealed details of the plan to deliver arms and ammunition to houses inside Mosul. Under torture, the fighter told all.

“Daesh succeeded in infiltrating Jabouri’s ring and executed him and almost all his men only a couple of months later,” said Kinani. Islamic State often tortured captives for weeks or months to extract information, officials said. Its “courts” handed down death penalties.

LICENCE PLATES AND BOMB FACTORIES

While Iraqi intelligence officials were talking to Jabouri, they also began seeking out civilians in Mosul whose relatives had been killed by militants. They calculated that desire for revenge might make them willing recruits.

Mahmoud, a cab driver, was one such informer. He told Reuters that Islamic State had jailed his brother and cousin in July 2014 for giving the Iraqi army information on its movements in Mosul. He never saw them again, he said.

“After they took my brother away I wanted to get back at them,” said Mahmoud, who asked that Reuters withhold his full name.

He eavesdropped on militants’ conversations in his cab. Dialing in from the basement of his home to an Iraqi security officer, he provided intelligence on buildings occupied by the militants, the location of car bombs and explosives factories.

“I used to take the sim card from my phone and hide it in the sugar jar or a sack of rice,” Mahmoud said.

The army sergeant turned informer, Alaa Abdullah, said he went into hiding when Islamic State took control of Mosul in 2014, rarely sleeping in the same place twice. As a former translator for U.S. troops during the U.S. occupation, he believed he was a target for the militants. He had also spent time training cadets in the Shi’ite south and feared the Sunni hardliners would brand him an infidel.

Abdullah hid his telephone in a water filter. His brother, like Mahmoud, drove a taxi to make a living and was a rich source of information.

“Daesh fighters would ride in his cab and he would tell me what he heard,” said Abdullah.

Abdullah worked with a police intelligence officer, Ayad Jassim, to put together a network of 30 informants in towns and villages near Mosul. Jassim, who was based in the town of Qayara, south of Mosul, confirmed the account. He said the informants provided details about militants’ movements, their vehicle licence plates and where they met. As a result, Jassim said, airstrikes by the U.S.-led coalition killed as many as 50 militants in some weeks.

“The success of the informers created an atmosphere of mistrust in Daesh. Militants were suspicious of each other,” added Jassim, who said he lost 27 members of his family to Islamic State.

"I was really afraid the whole time. Because you paid with blood, you paid with your life if you were caught."

A U.S official said Islamic State was “better at making enemies than they were at grabbing territory.”

Recognising the threat from informers, Islamic State made an example of captured spies.

When the group caught Ibrahim and Idrees Nasir breaking a ban on using cellphones, they discovered the men were in contact with Iraqi security forces by dialing the last number they had called, their cousin Nawfal Youssef said. They were killed with a bullet to the head.

“They hung them by telephone polls on a main street for 10 days. They stuck paper signs on their chests which said: ‘This man is a traitor. You will suffer the same fate if you cooperate with the infidel Iraqi security forces’,” Youssef said.

ADVANCES BRING DEFECTIONS

The conquest of Falluja, an Islamic State stronghold 60 km (40 miles) west of Baghdad, in June 2016 was decisive in the war against the militants, Iraqi officials said. Falluja had been the first city to fall to Islamic State, in January 2014. With its recapture, Iraqis increasingly believed the group could be defeated. The battle followed a pattern that would become familiar in the months ahead: Iraq’s counter-terrorism service, trained by the U.S. military, spearheaded the assault. Airstrikes by the U.S.-led coalition supported the advance. Shi’ite militias played an important role.

The Iraqi army’s progress on the battlefield through 2016 encouraged increasing numbers of Islamic State militants to betray their leaders, a top commander in the Mosul campaign, General Najm al-Jabouri, told Reuters. The capture of Qayara airbase and town about 60 km (40 miles) south of Mosul in July 2016 was an important moment.

A militant who handled Islamic State’s communications contacted the army through an intermediary to offer his services, said his handler, Major Sahab al-Jabouri. Given the codename Eagle 1, he was taught how to evade capture. Eagle 1 texted Major al-Jabouri with details about Islamic State leaders and telephone numbers used by the militants. Intelligence he supplied helped the army take several towns and led them to a mass grave in the town of Tal Afar, west of Mosul, Major al-Jabouri said.

The opening of a new front northwest of Mosul in May 2017 triggered more defections, according to Iraqi military officials. Militants offered information in exchange for clemency. The arrangement provided vital intelligence about Islamic State leaders, communications and ammunitions stores.

“It accelerated the battle,” said General al-Jabouri, the senior commander in the Mosul campaign. “They told us where the car bombs were and we would strike them before they hit our forces. Their information helped us a lot, especially in identifying where their leaders were.”

Once inside Mosul, U.S.-trained counter-terrorism troops cleared militants from the narrow streets. U.S. airpower picked out targets from above.

UNCERTAIN VICTORY

Some Iraqi officials concede questions remain over the long-term ability of the main Iraqi army to retain control of territory it has gained with the help of U.S. airpower, Shi’ite militias, and Kurdish fighters. Compared with U.S.-trained soldiers in Iraq’s highly capable counter-terrorism service, the bulk of the army is ill-equipped and lacks discipline.

Counter-terrorism troops had “the most updated American weapons and gear costing up to $16,000,” said Kinani, the army intelligence officer. “For ordinary soldiers, we give them a suit and vest that cost only $100.”

Despite its victory, Baghdad’s Shi’ite led government cannot count on the loyalty of Mosul’s predominantly Sunni population, said a leader of a powerful Sunni tribe that contributed fighters and intelligence to the battle against Islamic State. Mosul’s Sunnis want more autonomy, said Sheikh Talib al-Shammari of the Shammar tribe.

“Mosul residents should have a say in how to administrate their own city without being treated as second class citizens. We will have zero tolerance for any attempt from Baghdad to return Mosul to being governed by armed force; we will resist and find a million ways to ask for our own autonomy,” Shammari warned.

Zuhair al-Chalabi, a government adviser, said talk of autonomy was “the language of losers. Mosul is proud of its genuine Iraqi identity and no one will accept this language.”

Mosul is not alone in challenging Baghdad’s authority.

In the north of the country, Iraq’s Kurds are intent on building an independent state. They voted overwhelmingly for independence in a referendum on Sept 25. Baghdad says such moves are unconstitutional. Prime Minister Abadi’s government insists its focus is on ending sectarian strife.

The United States is afraid a fragmentation of Iraq could further destabilize the Middle East. Shi’ite Iran worries a breakup would diminish its influence. Iran holds sway over the Baghdad government and Iraq’s Shi’ite militias.

For some people in Mosul, Iraq’s wrecked economy and rampant corruption are the most pressing problems. Transparency International ranked Iraq 166 out of 176 in its 2016 Corruption Perceptions Index.

Standing near a bridge between east and west Mosul, a student informer, codename Salah al-Iraqi, doubted prosperity would return to his city.

“If we got rid of our leaders and political parties, Iraq would be much better off,” he said. “The whole system needs to be overhauled.”

Abu Hassan, a former soldier and informant, is also frustrated. He used his work as a cab driver to gather intelligence for the Iraqi military. He says his handlers promised that he could have his old army job and $1,000 a month salary back when Mosul was freed. But when he went to Baghdad to reclaim his job, he was sent packing, he said.

These days, Abu Hassan is bitter. He’s barely making $7 a day driving his cab. Iraq’s defence ministry dismissed his complaints.

“He should have done this to help his country and not for a job. This is the difference between real soldiers and mercenaries,” said Lieutenant Colonel Mahdi Ameer.

Additional reporting by Isabel Coles and Goran Tomasevic in Mosul, and John Walcott in Washington

Crumbling Caliphate By Michael Georgy, Ahmed Rasheed and Raya Jalabi Photo editing: Simon Newman Graphics: Michael Ovaska, Ciaran Hughes, Maher Chmaytelli, Simon Scarr, Gustavo Cabrera and Jessica Wang Design: Catherine Tai Edited by Janet McBride and Richard Woods