ISIS members who vowed to "fight to the death" in Mosul were killed trying to flee across a river, officials have said.

Iraqi military spokesman Brigadier General Yahya Rasool told state TV that 30 militants had died in their attempt to flee by swimming across the River Tigris that bisects the city.

Cornered in a shrinking area, ISIS members resorted to sending female suicide bombers among the thousands of civilians who are emerging from the battlefield wounded, malnourished and fearful, Iraqi army officers said.

This news came as the Iraqi Prime Minister Haider al-Abadi arrived in Mosul today and congratulated the armed forces for their "victory" over Islamic State after nearly nine months of urban warfare, bringing an end to jihadist rule in the city.

Members of the Iraqi federal police pose for a picture with an upside down Islamic State flag (Image: AFP)

Students walk by as smoke rises above Mosul University from air strikes in the battle with ISIS in West Mosul. July 3, 2017 (Image: Rex Features)

Read More

Islamic State's defeat in Mosul three years after taking the city is a major blow for the hardline Islamist group, which is also losing ground in its operational base in the Syrian city of Raqqa from where it has planned global attacks.

But ISIS still controls territory in Iraq and is expected to revert to more conventional insurgent tactics such as bombings as its self-proclaimed caliphate falls apart.

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 a million people.

Read More

"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.

State television later showed Abadi walking around Mosul, Iraq's second-largest city, with residents.

Air strikes and exchanges of gunfire could still be heard in the narrow streets of the Old City, where the group has staged its last stand against Iraqi forces backed by a U.S.-led international coalition.

Smoke billowing following an airstrike by US-led international coalition forces targeting Islamic State in Mosul. July 9, 2017 (Image: AFP)

Abadi met commanders in west Mosul who led the battle, but he has yet to issue a formal declaration that the entire city has been retaken from ISIS.

Abadi's spokesman, Saad al-Hadithi, said victory would not be formally declared until the few remaining Islamic State militants were cleared from Mosul.

Still, French President Emmanuel Macron - whose country is part of the coalition that has conducted air strikes and provided training and assistance to Iraqi forces on the battlefield, welcomed the defeat.

Members of the Iraqi federal police dance in celebration in the Old City of Mosul on July 8, 2017 (Image: AFP)

A picture taken on July 9, 2017, shows a general view of the destruction in Mosul's Old City (Image: AFP)

"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 United Nations predicts it will cost more than $1 billion to repair basic infrastructure in Mosul.