Iraqi forces on Thursday battled the last remaining Islamic State group fighters in Mosul's Old City, where the UN said up to 20,000 civilians are trapped and in "extreme danger".
In neighbouring Syria, US-backed forces are facing fierce resistance from IS as they wage a parallel offensive to recapture the city of Raqa from the jihadists.
The fighting in both cities is taking place in densely populated residential neighbourhoods, posing a major threat to civilians as diehard jihadists put up a desperate last stand.
"Our estimate at this stage is that in the final pockets of (Mosul's) Old City, there could be as many as 15,000 civilians, possibly even as high as 20,000," UN humanitarian coordinator in Iraq Lise Grande told AFP.
"They're in extreme danger from bombardment, from artillery crossfire. The (IS) fighters that are still there are still directly targeting civilians if they try and leave," she said.
More than eight months after the start of the operation to retake Mosul from IS, the jihadists have gone from fully controlling the city to holding a small pocket on the west bank of the River Tigris that flows through it.
On Tuesday, Prime Minister Haider al-Abadi congratulated the Iraqi people and the security forces on the "achievement of this major victory in Mosul," but the battle is not over yet.
Damage worse than feared
Iraqi forces are now between "80 to 100 metres" from the Tigris River, which marks the eastern boundary of IS-held territory in the Old City, said Staff Lieutenant General Abdulghani al-Assadi, a senior commander in the elite Counter-Terrorism Service.
"But that doesn't mean, for example, that we will reach the river today or tomorrow, because our movement is very slow," Assadi said, attributing that pace to efforts to protect civilians.
The battle for Mosul has pushed 915,000 to flee their homes, nearly 700,000 of whom are still displaced.
"We exceeded our worst case scenario more than a month ago. In our very worst-case scenario, we thought that 750,000 people would flee," Grande said.
The damage caused by the fighting in west Mosul -- and the cost of addressing it -- is huge.
There are "44 residential neighbourhoods in western Mosul. Six are nearly completely destroyed... Twenty-two neighbourhoods are moderately damaged and 16 are lightly damaged," Grande said.
Based on a preliminary assessment, the first phase of "stabilisation" in west Mosul -- which includes basic services, infrastructure, housing, education and police stations -- will cost $707mn.
That is nearly double the expected figure, "because the level of damage in western Mosul is far higher than what we feared it would be," she said.
Heavy civilian toll
As Iraq fights to retake Mosul, the US-backed Syrian Democratic Forces -- an alliance of Kurdish and Arab fighters -- have been battling IS in its de facto Syrian capital Raqa.
The SDF broke into Raqa on June 6 after a months-long operation to encircle the city and earlier this week penetrated its historic heart.
Tens of thousands of civilians are believed to be trapped inside the city, and there are fears the jihadists are using them as human shields.
The SDF assault has been backed by intense air strikes by the US-led coalition fighting IS, which the Syrian Observatory for Human Rights said has exacted a heavy toll on civilians.
At least 224 civilians, including 38 children, have been killed in air strikes since the SDF entered the city, the Observatory said.
The Britain-based monitor said it did not have a toll for civilians killed in other ways, including by other military operations, mines, or while trying to flee the city.
But the coalition pushed back against the report, saying its "critics" were not conducting "detailed assessments".
The coalition estimates some 2,500 jihadists are defending Raqa.
So far, 311 jihadists and 106 SDF fighters have been killed in the battle for the city, according to the Observatory, which has a wide network of sources on the ground.
The Observatory also reported that a large shipment of weapons, ammunition and armoured vehicles was delivered by the coalition to the SDF via Iraq.
The loss of Mosul and Raqa, IS's two most emblematic strongholds, would be a major blow for the jihadists, effectively ending the cross-border "caliphate" they declared in June 2014.
But they still hold other parts of Iraq and Syria, and are likely to revert to their insurgent roots, mounting hit-and-run and bomb attacks where they no longer hold territory.