MOSUL (REUTERS) - ISIS militants began reinventing themselves months before United States-backed Iraqi forces ended their three-year reign of terror in Mosul, putting aside the dream of a modern-day caliphate and preparing the ground for a different fight.
Intelligence and local officials said that a few months ago, they noticed a growing stream of commanders and fighters flowing out of the city to the Hamrin mountains in north-east Iraq which offer hideouts and access to four Iraqi provinces.
Some were intercepted but many evaded security forces and began setting up bases for their new operations.
What comes next may be a more complex and daunting challenge for Iraqi security forces once they finish celebrating a hard-won victory in Mosul, the militants' biggest stronghold.
Intelligence and security officials are bracing themselves for the kind of devastating insurgency Al-Qaeda waged following the 2003 US-led invasion, pushing Iraq into a sectarian civil war which peaked in 2006-2007.
"They are digging in. They have easy access to the capital," Mr Lahur Talabany, a top Kurdish counter-terrorism official, told Reuters. As part of the US-led coalition, he is at the forefront of efforts to eliminate the Islamic State in Iraq and Syria (ISIS).
He added: "I believe we have tougher days coming."
Some Iraqi ISIS fighters have roots dating back to Al-Qaeda's campaign of car and suicide bombs that exploded by the dozens each day and succeeded in fuelling a sectarian bloodbath in Iraq, a major oil producer and key US ally.
When a US-funded tribal initiative crushed Al-Qaeda, hardcore members regrouped in the desert between Iraq and Syria. They reappeared with a new militant brand that took the world by surprise: ISIS.
Shortly after its lightning sweep through Mosul, the group outdid Al-Qaeda's brutality, carrying out mass beheadings and executions as it imposed its ultra-hardline ideology.
Unlike Al-Qaeda, it seized a third of Iraqi territory, gaining knowledge of land that could come in handy as it hit back at Iraqi security forces.
SADDAM'S INTELLIGENCE AGENTS
Former Iraq intelligence officers who served under Saddam Hussein joined forces with ISIS in an alliance of convenience. These shrewd military strategists from his Baath Party are expected to be the new generation of ISIS leaders, Mr Talabany and other security officials said.
Instead of trying to create a caliphate, a concept which attracted recruits from disaffected fellow Sunni Muslims, ISIS leaders will focus on far less predictable guerilla warfare, Iraqi and Kurdish security officials said.
Iraqi forces have come a long way since they collapsed in the face of the ISIS advance in 2014, throwing down their weapons and removing their military uniforms in panic.
They fought for nearly nine months to seize Mosul, with steady help from US-led air strikes that flattened entire neighbourhoods.
The key question is whether an army that is far more comfortable with conventional warfare can take on an insurgency with sleeper cells and small units of militants who pop out of deserts and mountains, carry out attacks and melt away.
"They will try to hide with the population. Their cells will get smaller - instead of companies and platoons, they will go to squads and cells, much smaller elements hiding in the population," Lieutenant-General Steve Townsend, commander of the US-led coalition, told reporters.
"Our Iraqi security force partners will have to engage in counter-insurgency-style operations at some point and we are already making efforts now to start shaping their training towards that next ISIS tactic."
History suggests training may not be enough.
The US spent US$25 billion (S$34 billion) on the Iraqi military during the American occupation that toppled Saddam Hussein in 2003 and triggered an insurgency that included Al-Qaeda.
That did not prepare the army for the long-haired ISIS militants who sped into Mosul in pick-up trucks with weapons stolen from retreating Iraqi troops.
Iraqi forces can certainly point to successes in Mosul and the cities of Falluja and Ramadi in Anbar province, once held by ISIS.
But local officials say the cities remain vulnerable to attacks from the vast desert nearby mastered by militants. "Security operations will be useless unless security forces control the desert," said Anbar official Emad Dulaimi, adding that the desert had become a safe haven for ISIS.
"It is not present as an organisation in cities but it carries out attacks by individuals. Car bombs. Suicide bombers. People fear ISIS will come back. There are attacks every day."
Mr Tareq Youssef al-Asal, the leader of a tribal force, shares those concerns and complains of what he says is a lack of a coordination among numerous local security forces. "In the end, these leaderships have no experience fighting in the desert," he said.
Some ordinary citizens still do not feel safe despite the Iraqi army's improved performance.
Anbar resident Ahmed al-Issawy does not plan on reopening his restaurant any time soon. He is afraid it will be destroyed the same way it was in clashes between security forces and ISIS in 2014. "I am afraid there could be an attack at any second," he said.
ISIS has not wasted any time in implementing its new strategy despite a major loss in Mosul.
About 30 militants armed with machine guns and mortars crossed the Tigris River in wooden boats, attacked the village of Imam Gharbi, some 70km south of Mosul, in early July and then pulled out, according to security officials.
"The notion of a caliphate is gone. The dream is gone. They will revert to their old tactics of hit-and-run attacks," said senior Kurdish official Hoshiyar Zebari, a former Iraqi foreign minister. "The hardcore will keep fighting."