Iraq's Prime Minister Haider al Abadi cancelled plans to declare “victory” in Mosul on Sunday, as the fight against Daesh still continued in two small neighbourhoods in the Old City.
The battle rages on in Qiliat and Shahwan, which are still under Daesh’s control.
"Victory is certain, and what remains of Daesh is surrounded ... and it is just a matter of time for us to announce the great victory to our people," Abadi said in a statement.
"There are just one or two pockets of Daesh remnants left," and "the major victory is in hand," the premier added.
TRT World spoke to journalist Ash Gallagher who is following the developments from Erbil in Iraq.
That victory comes at an enormous cost.
Thousands have been killed and wounded, nearly a million people forced from their homes and much of the city has been left in ruins.
Enormous challenges lie ahead, not just in rebuilding Mosul but in tackling Daesh elsewhere in Iraq.
Photographs showed Abadi dressed in a black military uniform and cap, shaking hands with police and army officers.
Abadi met commanders in Mosul and issued a series of orders on "sustaining victories and eliminating the defeated remnants" of Daesh, as well as "establishing security and stability in the liberated city."
French President Emmanuel Macron was among the first world leaders to offer his congratulations.
"Mosul liberated from Daesh," he tweeted.
"Homage from France to all those, with our troops, who contributed to this victory."
British Defence Secretary Michael Fallon also congratulated Abadi and the "Iraqi forces who have been fighting on the ground with great bravery."
The European Union called the victory "a decisive step in the campaign to eliminate terrorist control in parts of Iraq."
Iran's Foreign Minister Mohammad Javad Zarif also congratulated Iraq in a tweet on Sunday.
Congratulations to brave people & Government of Iraq upon liberation of Mosul. When Iraqis join hands, no limits to what they can achieve.
— Javad Zarif (@JZarif) July 9, 2017
Daesh loses much ground
Daesh swept across much of Iraq's Sunni Arab heartland in a lightning offensive in mid-2014, proclaiming a "caliphate" straddling Iraq and neighbouring Syria.
Imposing its fraudulent interpretation of Islamic law, the group committed widespread atrocities and organised or inspired deadly attacks in Iraq, Syria and abroad.
As a result of a decisive offensive launched by Iraqi forces to recapture Mosul in October, Daesh has lost most of the territory it once controlled.
A coalition is also aiming to oust the militants from their Syrian stronghold Raqqa, which is under assault by US-backed rebel forces.
Iraqi forces seized Mosul's eastern side in January and launched the battle for its western part the next month.
But the fight grew tougher when security forces entered the densely populated Old City on the western bank of the Tigris River, which divides the city.
In recent days, security forces have killed militants trying to flee their dwindling foothold in Mosul, as Iraqi units fought to retake the last Daesh-held territory near the Tigris.
Earlier Sunday, Iraq's Joint Operations Command said security forces had killed "30 terrorists" trying to escape across the river.
Even in the final days of the battle, thousands of civilians remained trapped inside the Old City and some of those who fled arrived grief-stricken after losing relatives in militants' sniper fire and bombardments.
The United Nations said Sunday that 920,000 civilians have fled their homes since the battle for Mosul began last autumn.
"It's a relief to know that the military campaign in Mosul is ending. The fighting may be over, but the humanitarian crisis is not,” said Lise Grande, the UN's humanitarian coordinator in Iraq.
The recapture of Mosul will also not mark the end of the threat posed by Daesh, which controls territory elsewhere in Iraq and is able to carry out frequent bombings in government-held areas.
In Iraq it holds towns including Tal Afar and Hawijah in the north, as well as territory in western Anbar province.
It also continues to hold significant territory in Syria, including in Raqqa, where the US-backed Syrian Democratic Forces (SDF) are battling to oust the militant group after penetrating its fortified historic centre.