The liberation of Mosul is complete. Islamic State is unlikely to again govern and control large swaths of territory in the near future. While the past three years of war have been brutal, there will be some justice and respite for those who have lost friends and family to Isis, as well as for the broader Iraqi population that has had to put up with it and its ilk for more than a decade.

Good news from Mosul does not signal the end of Islamic State Read more

However, while there is some reason to celebrate, the end of the so-called caliphate does not mean the end of Isis: the jihadi organisation still controls strategically important, if smaller, patches of territory in places such as Hawija and Tal Afar, and will continue to enjoy the infrastructure that will allow it to continue terrorist attacks in the country. To make the liberation of Mosul count, the Iraqi government will now have to take on the more difficult long-term challenge of confronting militant groups by way of reconstructing the country and reconciling its communities and political factions.

The war on Isis has resulted in a far-reaching humanitarian crisis. Multiple Iraqi towns and cities have been destroyed during the course of the military campaign, more than 3 million people have been displaced and 11 million require assistance, according to international organisations. Rehabilitating local communities and economies, and bridging the differences between and among the diverse sections of Iraqi society is fundamental to ensuring Isis does not enjoy the space and structural conditions that enable it to mobilise supporters and resources.

But will the government make the most of this opportunity? There is little to suggest that the Baghdad government has either the capacity or vision to move the country forward. This is, after all, a political class that has received billions of dollars in support and investment from the international community over the past decade, yet has little to show for it.

Prime minister Haider al-Abadi should be commended for his composure and conciliatory style of government since replacing the controversial former prime minister Nouri al-Maliki in 2014. However, the prospects for stability are reduced by both the lack of a framework that could reconcile differences among the political class and the heavy build-up of disparate, rival actors in and around Mosul, ranging from Shia militia groups to Arab Sunni tribes and the Kurdish Peshmerga forces.

Isis and other militant groups will thrive unless credible, legitimate and viable governing structures are established. Iraq’s Arab Sunnis must never again have to be stuck between, on the one hand, a government perceived to be sectarian and whose sanctioning of Shia militias and neglect of northern Iraq has confirmed such fears and, on the other, militant groups that exploit these fears to swell their ranks.

Facebook Twitter Pinterest Civilians in Baghdad celebrate the liberation of Mosul. Photograph: Ali Abbas/EPA

Northern Iraq is now dominated by powerful Shia militia groups aligned with Iran (among them groups that have fought the Iraqi army in the past). They have repeatedly challenged the federal government and will represent a continuing problem for the Iraqi state. But Iraq’s Iran-aligned Shia militias are not going anywhere – they have capitalised on the war on Isis to establish themselves in northern Iraq, particularly in Tal Afar, which both lies close to key disputed territories and constitutes an important transit point for reinforcing fighters and supplies in Syria (where Iraq’s Shia militias and the Iranian regime are fighting in support of the Assad regime).

The presence of these groups does not bode well for Iraq’s crisis of authority and governance. They are feared by local Arab Sunni populations because of their sectarian atrocities and human-rights abuses. And it is unclear what form of political and administrative structure will replace Isis and address the concerns and grievances of the local population. Viable local government is not just a matter of security but is also fundamental to reconstruction efforts and the international support on which it depends. There will not be another chance for Iraq unless it begins to make the colossal investment count.

Amid the ineptness and corruption that plague the government in Baghdad and the Iraqi state, a thriving civil society has emerged in recent years that may represent the country’s best (and only) hope for the future. Iraq’s civil society has braved jihadis, Shia militias and the corrupt elite to do its utmost to foster pluralism and co-existence, and is attempting to hold the elite to account. Its people are better placed to do so than outside actors but lack sufficient support internationally. Indeed, while the west is grappling with its own challenges at home, that does not mean it should allow Iraq to fall off the radar, as it did before, in the years preceding the emergence of the so-called caliphate (the consequences of which have now been felt globally).

Many of Iraq’s problems are attributable to the failures of the international community. Long-term, proactive and creative engagement with the Iraqi state and population could reduce the space that groups such as Isis or Shia militias beholden to foreign interests enjoy. Where the US and its allies disengage, it is often its enemies that prosper, and the moderate, reformist Iraqis that suffer.