THE fireworks have been ordered. Street parties are planned. The Iraqi government has prepared a week of festivities to mark the fall of Abu Bakr al-Baghdadi’s self-proclaimed caliphate. Three years after seizing control of the great alluvial plains of the Tigris and the Euphrates, Islamic State, which has claimed so many victims in north-western Iraq, Syria and beyond, is finally dying. American-led forces in Syria breached the old city walls of IS’s capital, Raqqa, on July 4th. In Mosul, in Iraq, all but the last alleyways of the Old City were back in government hands as The Economist went to press on July 6th.

Finding a backdrop from which to celebrate the liberation of Mosul will be difficult, though. Between them, IS and the coalition have destroyed too many shrines and mosques to leave much of historic value, including the al-Nuri mosque dating back to Crusader times from where Mr Baghdadi proclaimed himself caliph. Gone is the Jewish quarter, the markets with their monasteries, and the lattice balconies and sculptured masonry of another Sunni silk road city. “Overlooking the Tigris, there could be no nobler or more beautiful place to sit in,” waxed Ibn Jubayr, a Spanish travel writer who visited in the 12th century. What one side booby-trapped, the other side shelled. Almost half the neighbourhoods of west Mosul have been destroyed, including much of the Old City, estimates a foreign observer, perhaps some 20,000 houses in all. “Like Dresden,” an American general was heard muttering, touring the ruins.

The odour of putrefaction hangs in the hot air. Cameramen entering the honeycomb of the Old City return with footage of bodies, old and young, lying under blankets in front rooms for days. Many more are buried under the rubble. Thousands trapped in the alleys IS still holds are without water or food. Iraqi soldiers maintaining a siege prevent aid workers from getting food to those inside.

Previous battles for the city have been short-lived. In 1918 and 2003, opposition melted away when British and American forces respectively marched in. Even in the earlier battle for east Mosul, IS fighters ceded one neighbourhood after another, and retreated west over the Tigris and into Syria. But besieged in their western redoubt, they have nowhere else to go. Unlike during the fall of Aleppo to the Assad regime earlier this year, no one has negotiated safe passage in the final stages of battle. The fighting goes on alley by alley.

The clear-up operation will do much to determine whether Iraq’s government wins the war as well as the battle. Mosul’s exodus has realised the UN’s worst-case predictions. About 900,000 of the city’s 2m people have been displaced; 700,000 are still homeless. The prime minister, Haider al-Abadi, wants to get people home quickly, but the UN says 200,000 have none to return to. Most of the latter come from poor neighbourhoods, like the Old City, where IS found many recruits. Strewn across Iraq, they may now spread their anger countrywide. Other reconstruction operations are proceeding slowly, too. Six months after its liberation the east side remains cut off from the electricity grid. For want of water, the UN is carting in 6m litres a day. Schools quickly reopened, but initial jubilation has turned to despondency among teachers who, six months on, remain unpaid. Mosul’s university, once home to the region’s best engineering college, lies destroyed and abandoned. The coalition should know better. In 2003 America’s forces rested on their laurels after their race to Baghdad, letting insurgents fill the vacuum. They did the same after beating back al-Qaeda in 2007. But once again, reconstruction is a distant prospect. Iraqi ministers estimate that rehabilitating areas liberated from IS will cost $100bn, roughly the sum they and the Americans spent on the war. But the government is broke. Sunni Gulf states are said to be considering involvement, but have contributed next to nothing. The World Bank has reportedly committed $300m. Germany is offering €500m ($570m). Coalition talks on a ten-year reconstruction plan, set to begin in Washington on July 10th, might drum up a bit more. But, runs an Arabic proverb, commitments are clouds, implementation the rain. Even if money is found, procurement and contracts will take time. “It will take a year before you see anything happening,” says Ammar Shubbar, an Iraqi economist. “And that will be patchwork—some sewage repair here and there.” Almost a year after taking Qayyarah to the south of Mosul, Iraq’s government has yet to reconnect it to the grid. General Electric, an American company that won the contract, says it is still trying to negotiate financing. Danger and corruption, says a GE employee, are further hampering the company’s hopes of re-entering Mosul. And material reconstruction is only part of the task. More perturbing than the children who shriek at the bombardment around them are those who barely flinch. In Mosul, the initial relief at liberation from IS’s reign of terror is already turning to grumbling. IS ran services and rubbish collection better, say residents. They repaired the potholes in the road faster and kept electricity going. “Why did the Iraqi government abandon us to IS in 2014, only to destroy our city when they returned?” asks a Mosul University graduate. Locals still report lurking fighters and suspicious packages to the plethora of security forces in the city. After a lull of several months, sleeper cells are reawakening in the east of the city. Suicide bombing has begun again. In the space of a week last month, three mukhtars, or neighbourhood elders, were killed. Some predict the return of a low-level insurgency much as before IS swept control in June 2014. After all, though Iran and Russia say that Mr Baghdadi is dead, his organisation still occupies swathes of (thinly-populated) territory either side of the Iraqi-Syrian border.

IS’s vestiges, though, may anyway be one of the lesser problems facing Iraq. Exultant armies and militias now occupy the ground once held by the caliphate. A generation of young Iraqis currently earn a living from fighting IS; they may now develop ambitions of their own. Having avoided confrontation while they were assaulting IS, America and its allies are now coming to blows with Iran and its allies across the border in south-eastern Syria. A similar struggle looms in Iraq. Meanwhile, Iraq’s politicians squabble, largely confined to the Green Zone, the walled city within a city occupying the core of Baghdad. So far there is not much sign of the fresh dawn that IS’s downfall should bring.