ISIS Near Defeat in Iraq. Now Comes The Hard Part.

The collapse of the Islamic State in its most important Iraqi strongholds has brought a rare moment of hope for a country mired in war for most of the past four decades.

It is also a moment of peril, as Iraq emerges from the fight against the militants only to be confronted with the same problems that fueled their spectacular rise in 2014.

Old disputes between Sunnis, Shiites and Kurds over territory, resources and power already are resurfacing as the victors of the battles compete to control liberated areas or jostle for political advantage in the post-Islamic State landscape.

These rivalries now are compounded by the mammoth task of rebuilding the towns and cities destroyed by the fighting, returning millions of displaced people to their homes, and reconciling the communities that once welcomed the Islamic State’s brutal rule as preferable to their own government’s neglect and abuse.

A failure to manage the post-conflict situation risks a repeat of the cycle of grievance and revolt that fueled the original Iraqi insurgency in 2003, and its reincarnation in the form of the Islamic State after 2011, Iraqis and other observers say…