It has taken a long and devastating campaign to wipe IS from the map after the jihadists threatened Iraq’s very existence by seizing roughly one third of its territory in 2014.
Troops backed up by the air power of a US-led coalition have waged some of the fiercest urban warfare seen anywhere in decades to oust the jihadists from a string of cities and towns across the country.
But while Baghdad may be basking in its battlefield success for now, relying on military might will not be enough in the longer term.
“Everything remains to be done to dry out the earth on which IS flourished,” said Karim Bitar, a regional expert at the Paris-based Institute for International and Strategic Affairs.
“The jihadists have been deprived of oxygen and defeated militarily but the womb from which they emerged remains fertile.”
WATCH: Iraq launches operation to clear ISIS from desert near Syria
Now the fighting is finished, the list of demands facing Iraq’s authorities is daunting — and includes many key challenges that Baghdad has failed to address for years.
“It involves first of all consolidating the power of the central authorities while pursuing inclusive policies that do not marginalise any community,” Bitar said.
“Then it is necessary to tackle reconstruction, economic and social problems, stem corruption and ensure the equitable distribution of oil incomes.”
All of this comes with Iraq on its knees after the brutal years of IS rule in the territory it controlled and the harrowing battle to defeat the jihadists.
A donor meeting for the country is set to be held in Kuwait in February and estimates put the reconstruction bill facing Iraq at some $100 billion (85 billion euros).
Iraq expert Mohammad Ould Mohamedou, a professor at Geneva’s Graduate Institute, cautioned that even the victory on the battlefield might not be as definitive as its seems.
Key to preventing a resurgence by the jihadists will be dealing with the profound sectarian grievances among Iraq’s Sunni community on which IS fed.
Sidelined in the wake of the 2003 US ouster of Saddam Hussein and targeted by the Shiite-dominated authorities, Sunnis provided fertile ground for the jihadists.
But the harshness of IS rule ended up turning many Sunnis against them and now the group’s fighters are gone the government needs to seize the opportunity to bring the community onboard.
“The work of reconstruction, in this case, is as much social as in terms of infrastructure,” said Ould Mohamedou.
Even if Iraq’s government is serious about tackling the sectarian divide, the regional tug-of-war between Shiite Iran and Sunni Saudi Arabia could make it all the more difficult.
The two Middle East titans are locked in a power struggle that stretches from Lebanon through Yemen and Syria, and now Iraq could start figuring more prominently in the tussle.
WATCH: Canada offers ‘reintegration support’ for ISIS fighters
“The Iranians and the Iraqi Shiite community remain in a position of strength, with control of the main levers of state,” said Bitar.
“But the Saudis could become more active in the coming months as they seek to stem and repel Iranian influence on a regional scale.”
Disarming the militias
As all attention has focused on wiping out IS, experts and Iraq’s Western backers warn that another major threat may have emerged from within the very fight to defeat the group.
That is the rise and legitimisation of the array of militia groups who clubbed together under the banner of the Hashed al-Shaabi, Popular Mobilisation force, to play a key role in defeating IS.
While to some the militia fighters are heroes who came to Iraq’s aid in its hour of need, others fear they are an unruly and unaccountable force.
Nominally under the command of the Iraqi Prime Minister Haider al-Abadi, the Hashed are dominated by Iranian-backed groups accused of being proxies for Tehran.
They have fought on the front line against Is but been accused of a raft of abuses, often revenge attacks directed against Sunnis.
WATCH: U.S.-backed forces liberate ISIS capital of Raqqa
How the central government now goes about dealing with the 60,000 to 140,000 fighters estimated to have joined the Hashed, and whether Baghdad can really bring them to heel, is a major issue.
“The biggest security challenge is internal, because many of the myriad of Hashed groups are turning into local mafias, setting up illegal checkpoints, toll roads, and the like, to support themselves financially,” said Kirk Sowell, an expert who publishes Inside Iraqi Politics.
“In this sense, IS is more relevant to the rest of the world, but for Iraqis, a local armed gang which needs money is far more dangerous.”