Lieutenant General Abdulwahab al-Saadi, the Iraqi commander of the Iraqi forces fighting to retake Fallujah, June 23 that his units held 80 percent of the city. This contrasts with the estimate from the U.S. military spokesman in Iraq on June 22, who that Iraqi forces held only a third of the city. Whatever the exact figure, after heavy fighting, often street-by-street, the Islamic State will lose the city. Losing Fallujah will be a significant blow to the Islamic State’s prestige, whose motto is that it “is staying and expanding.”

There are many more battles with ISIS ahead in Iraq, however, and the Iraqi forces’ recapture of Fallujah, as well as their retaking Ramadi last December, offer important lessons for those battles to come. The Iraqi forces generally fought well in Fallujah, but there still are not enough of the counter-terrorism and reliable police units to move quickly. ISIS, many of whom are experienced insurgents, have tried to re-infiltrate parts of Ramadi, according to a pro-government Sunni Arab sheikh to Al Mada newspaper on June 19. Indeed, in a sense, the Iraqis and their international coalition partners are fortunate that ISIS repeated the mistake of Kobani and tried to hold their ground in Fallujah, thus enabling superior Iraqi and U.S.-led airpower to pound them. As its resources dwindle, ISIS will likely adjust its tactics, and having reliable forces, not just to take ground but to hold it, will become ever more important as more ground is recaptured from the Islamic State.

In Fallujah, many of the forces holding the rear areas were Iranian-backed Popular Mobilization Units (P.M.U.). Predictably, there were hundreds of Sunni Arabs detained and then serious allegations of human rights abuses committed against them by the Shiite militias. The main Sunni Arab political bloc charged the federal police with allowing the Shiite militias into central Fallujah against the prime minister’s orders. The bloc acknowledged the P.M.U. were somewhat better as the Fallujah battle progressed, but serious against civilian occurred, a charge the Anbar governor . Interior Minister Mohammed Salem al-Ghabban, who was a leader in the Badr Brigades militia, acknowledged publicly that it was difficult to stop abuses of civilians fleeing the Islamic State, but he to punish any perpetrators. Prime Minister Haider al-Abadi has ordered an investigation, but Iraqi investigations of similar abuses elsewhere have never led to accountability.

Meanwhile, Sunni Arab militias were also detaining alleged ISIS members and sympathizers. There is the likelihood of additional score-settling within the very fragmented Sunni Arab community. Saadi once Fallujah is liberated, the Anbar governorate, local police and Sunni militias will be in charge of the city. While that may assuage concerns of sectarian killings, it does not assure quick calm. There are already of struggles for local governorate power between Anbar sheikhs and the Iraqi Islamist Party. The courts are not operative yet, the police are hard pressed in the frontline battles and the rule of law is weak. The Atlantic how cycles of revenge and retaliation within local Sunni Arab communities helped the Islamic State spread in 2013. There is a big risk that without a transparent and widely accepted process of implementing rule of law and accountability, and of determining local leaders, the cycles will continue, helping an Islamic State in insurgency-mode recruit.

A different problem is managing refugees. Some 80,000 in total fled Fallujah, overwhelming the Iraqi and international agencies’ local capacities. Mosul and Deir Ezzor in Syria are much larger cities than Fallujah, and Raqqa’s population now is probably at least as large as Fallujah’s at the beginning of the Iraqi government’s offensive. There will need to be a much larger international effort present-at-hand, as Iraqi government resources are stretched already and U.S.-backed Syrian Democratic Forces fighting the Islamic State in Syria have little humanitarian assistance capacity.

The lack of locally generated resources also foretells difficulties with the necessary rebuilding of cities retaken from ISIS. Once fighting concludes, tens of thousands of refugees will likely seek to return to their homes. The mayor of Ramadi Al Mada on June 19 that 32,000 of Ramadi’s 46,000 families had begun returning to the heavily damaged city. He commented that only one of Ramadi’s 21 bridges has reopened, and there was little funding to repair the others. Raqqa and Deir Ezzor, Syrian provincial capitals, have already suffered great destruction. Iraq’s government, suffering from major budget shortfalls and I.M.F.-backed fiscal restrictions, will have to scramble to find resources to rebuild.

In Syria, meanwhile, there is no clear authority responsible for rebuilding, nor is there ready funding, as shattered Kobani has seen. Rebuilding, however, is critical. Two opinion of Arab youth this spring highlighted that unemployment was the top factor leading Arab young people to join extremist groups. One of the studies, focused on Syrians, that the second main factor boosting extremist recruitment is prolonged exposure to violence and abuses. The latter suggests that without addressing the broader Syrian civil war, instead of focusing solely on ISIS, it will be difficult for the U.S.-led coalition to shut down extremist recruitment in Syria.

As challenging as it will be, retaking cities like Mosul, Raqqa and Deir Ezzor is the easier part of the task ahead to destroy ISIS. Holding ground, reestablishing governance and rule of law, and rebuilding homes and infrastructure, all of which are vital for a sustainable solution to the extremist challenge in Iraq and Syria, will be far harder still.