When Iraqi Prime Minister Haider al-Abadi announced this week that his army had defeated the Islamic State group in Mosul, he knew it wasn’t all over yet.

The morning after the victory declaration, which was accompanied by congratulations and well-wishes from world leaders, the Iraqi air force continued to bomb targets in the city’s western sections, the artillery still roared and street battles continued against pockets of ISIS resistance.

Gen. Stephen Townsend, who commands U.S. forces in Iraq, sounded doubtful when clarifying that “there are still fierce battles going on and ISIS has not been removed from Iraq yet.”

Iraqi flags fluttering over western sections of Mosul, blaring car horns and joyous citizens could be misleading. Most of the city has indeed returned to government control. But the worry is that even if the Islamic State loses one of its most precious holdings – in which it demonstrated the ability to run the second-largest city in Iraq while handling massive financial resources – it will splinter into smaller groups, cells or squads that will keep alive the battle, which has been ongoing for more than three years. Thus, from being a terrorist organization taking over territory for the establishment of a state, it will return to operating along the blueprint established by Al-Qaida.

This is just one of the unanswered questions now roiling Iraqi and international discussions of what happens the day after ISIS is vanquished.

For Iraq, this will be the stage that determines its fate as a functional, united state. For Western powers, especially the United States, this stage will determine whether they announce the fulfillment of their goals with a victory in the fight against terror, thus beginning a disengagement from Iraq and addressing terror at home, or whether they deal with the next stages as well, which will involve the reconstruction of Iraq and the return of normal life there.

Hundreds of thousands of refugees are expected to return to destroyed homes, to shattered infrastructure and internal power struggles. These struggles will determine whether the Islamic State, or any other similar group, has any chance of revival – or whether Iraq succeeds in establishing a new pattern of relations between the regime and the multitude of communities that make up Iraqi demographics, in a manner that prevents the sprouting of groups and militias that have their own agendas, be they religious or sectarian ones.

The first test for the chances of national reconciliation will be the absorption of the near-900,000 refugees and displaced persons who fled Mosul over the last three years. According to estimates by journalists and human rights groups, nearly 6,000 civilians were killed in the battle for the western part of the city. There are no authoritative estimates of the number of dead in the eastern parts, which were liberated a few months ago. The assessment of the total number of people killed in the battle against the Islamic State is based on estimates that cannot be substantiated.

Mosul is a mixed city. Most of its inhabitants are Sunni Muslims, but it also has a large Turkmen minority, along with Shi’ite Muslims and Kurds.

Open gallery view Iraqis driving a stripped-down car in west Mosul, July 12, 2017. Credit: FADEL SENNA/AFP

One of the main reasons the city fell to the Islamic State so easily in the summer of 2014 was the cooperation of Sunni residents and tribesmen with ISIS. This didn’t arise from their fervent belief in radical Islam, but in reaction to the bullying, harassment and discrimination the Sunnis were subjected to by the government – and mainly due to an abusive attitude by the army toward the city’s residents.

The citizens of Mosul and its outlying areas treated the Iraqi army as an occupying army, not a national one. People were humiliated at checkpoints on roads leading into the city and on its outskirts. Their money was stolen by soldiers, many were beaten and their cars confiscated. Even after the liberation of western sections of the city, soldiers treated residents’ property as their own. Troops took over abandoned houses on the pretext that ISIS collaborators had lived there.

Stores that had remained intact were looted and the members of Shi’ite militias, funded by Iran but attached to the Iraqi army, arrested and imprisoned thousands of civilians.

Together with Iraqi police forces, they are managing the liberated parts of the city as if it were a large open-air prison. It’s true that some semblance of a normal routine has been established, with schools reopening, as well as some clinics and hospitals. But the double trauma of the murderous ISIS occupation, as well as the trauma caused by the conduct of soldiers and Shi’ite militants, could block any national reconciliation. Yet this is vital for the integration of the Sunni community and for halting isolationist trends, which have led to a disconnect between the regime and Sunni Muslims, enabling the ISIS takeover.

Another point of dispute lies at the intersection of Kurdish and Iraqi government forces. The Kurds say they have no intention of withdrawing from territory they captured from the Islamic State, which includes towns and villages close to Mosul. Their long-standing claim is that Mosul used to be part of their “Promised Land,” and they now intend to fulfill that promise. Their argument is that after 11,500 Kurdish fighters died or were wounded in the battle against ISIS, they will not return areas for which Kurdish blood was spilled to the federal government.

Demarcating the boundary of Kurdish control has become a key issue since the government in the Kurdish region, led by Masoud Barzani, has announced a referendum over independence, to be held in September. The Kurds are trying to allay Turkish and Iraqi concerns, claiming this is only a referendum, not a declaration of independence. But even if independence is delayed due to opposition by neighboring countries, the question of borders could turn into a diplomatic or even armed struggle, since this issue will determine the future of oil fields within the Kurdish region.

So far, Iran has been the main beneficiary of the war against the Islamic State in Iraq. The Shi’ite militias and the presence of Iranian Revolutionary Guard units, as well as the conducting of some of the campaign by Quds force commander Qasem Soleimani, and the overall coordination with the Iraqi government, have turned Iran into much more than an assisting state.

Iran began setting up political and economic centers of influence in Iraq in 2003, turning cooperation with it into a strategic lever while making Iraq a vassal state. Iran, which also has excellent ties with some Kurdish factions, now has a land corridor linking Tehran with Syria.

Two issues remain unresolved. One is the struggle for leadership in the Islamic State, given the unconfirmed reports of the death of its leader, Abu Bakr al-Baghdadi, last month. There is also a struggle between Iraqi and foreign fighters within ISIS over control of Tal Afar, east of Mosul. It’s unclear whether foreign ISIS fighters will return home to contend with local security agencies or join groups in Egypt and Libya, or attempt sporadic attacks in the West.

U.S. President Donald Trump will have to decide whether to withdraw American forces from Iraq and Syria after cities held by the Islamic State are recaptured, and whether to help in rebuilding Iraq. This will largely depend on developments in the United States, and on his political and legal standing.