Iraqi Prime Minister Haider al-Abadi arrived in Mosul on Sunday and congratulated the armed forces for their "victory" over Islamic State after eight months of urban warfare, bringing an end to jihadist rule in the city.
Islamic State's defeat in Mosul three years after taking the city is a major blow for the radical Sunni Muslim group, which is also losing ground in its operational base in the Syrian city of Raqqa, where it has planned global attacks.
The battle for Mosul – by far the largest city to fall under the militants' control – has left large areas in ruins, killed thousands of civilians and displaced nearly one million people.
The group, however, still controls territory in Iraq and is expected to revert to more conventional insurgent tactics such as bombings as its self-proclaimed caliphate is dismantled.
"The commander in chief of the armed forces Haider al-Abadi arrived in the liberated city of Mosul and congratulated the heroic fighters and Iraqi people for the great victory," his office said in a statement.
French President Emmanuel Macron, whose country is part of an international coalition which backed the campaign with airstrikes, training and assistance on the battlefield, welcomed the defeat in Mosul of the group also known as ISIS.
"Mosul liberated from ISIS: France pays homage to all those, who alongside our troops, contributed to this victory," Macron said on his Twitter account.
Iraq still faces uncertainty and long-term stability will be possible only if the government contains ethnic and sectarian tensions which have dogged the country since the overthrow of Saddam Hussein in 2003.
The fall of Mosul exposes fractures between Arabs and Kurds over disputed territories, and between Sunnis and the Shi'ite majority.
The decaying corpses of militants lay in the narrow streets of the Old City where Islamic State has staged a last stand against Iraqi forces backed by a U.S.-led coalition.
The group vowed to "fight to the death" in Mosul, but Iraqi military spokesman Brigadier General Yahya Rasool told state TV earlier on Sunday that 30 militants had been killed attempting to escape by swimming across the Tigris River that bisects the city.
As Iraqi forces reached the riverbank of the Tigris, ISIS militants threw themselves into the water.
Cornered in a shrinking area, the militants have resorted to sending women suicide bombers among the thousands of civilians who are emerging from the battlefield wounded, malnourished and fearful.
The battle has also exacted a heavy toll on Iraq's security forces.
The Iraqi government does not reveal casualty figures, but a funding request from the U.S. Department of Defense said the elite Counter Terrorism Service, which has spearheaded the fight in Mosul, had suffered 40 percent losses.
The United States leads an international coalition that is backing the campaign against Islamic State in Mosul by conducting airstrikes against the militants and assisting troops on the ground.
The Department of Defense has requested $1.269 billion in U.S. budget funds for 2018 to continue supporting Iraqi forces.
Without Mosul – by far the largest city to fall under militant control – Islamic State's dominion in Iraq will be reduced to mainly rural, desert areas west and south of the city where tens of thousands of people live.
It is almost exactly three years since the ultra-hardline group's leader Abu Bakr al-Baghdadi proclaimed a "caliphate" spanning Syria and Iraq from the pulpit of the medieval Grand al-Nuri mosque.
Abadi declared the end of Islamic State's "state of falsehood" a week ago, after security forces retook the mosque – although only after retreating militants blew it up.
The United Nations predicts it will cost more than $1 billion to repair basic infrastructure in Mosul. In some of the worst affected areas, almost no buildings appear to have escaped damage and Mosul's dense construction means the extent of the devastation might be underestimated, UN officials said.
The militants are expected to revert to insurgent tactics as they lose territory.
The fall of Mosul also exposes ethnic and sectarian fractures between Arabs and Kurds over disputed territories or between Sunnis and the Shi’ite majority that have plagued Iraq for more than a decade.
Want to enjoy 'Zen' reading - with no ads and just the article? Subscribe todaySubscribe now