Iraq's Prime Minister Haider al-Abadi announced on Sunday "victory" over Daesh in the city of Mosul, his office said.
Abadi "arrives in the liberated city of Mosul and congratulates the heroic fighters and the Iraqi people on the achievement of the major victory," his office said in a statement.
The announcement comes after a gruelling nearly nine-month battle to retake the northern city from the jihadists after three years under their rule.
* A handout picture released by the Iraqi prime minister's press office on July 9, 2017, shows Iraqi Prime Minister Haider al-Abadi (C) walking alongside police and army officers upon his arrival in Mosul. (AFP)
A photo on Abadi's official Twitter account showed him dressed in a black military uniform and cap as he arrived in Mosul to announce the recapture of the city.
The fighting did not seem to be completely over yet, with gunfire still audible in Mosul and air strikes hitting the city around the time the premier's office released the statement.
The declared victory in Mosul marks an epic milestone for the Iraqi security forces, who had crumbled in the face of an Daesh onslaught across Iraq in 2014.
* A handout picture released by the Iraqi prime minister's press office on July 9, 2017, shows Iraqi Prime Minister Haider al-Abadi (c) shaking hands with army officers upon his arrival in Mosul. (AFP)
Daesh swept across much of Iraq's Sunni Arab heartland in a lightning offensive that year, proclaiming a self-styled "caliphate" straddling Iraq and neighbouring Syria.
But the jihadist group, which is facing twin offensives backed by a US-led coalition in both countries, has since lost large parts of the territory it once controlled.
The Iraqi forces launched their campaign to recapture Mosul in October, seizing its eastern side in January and launching the battle for its western part the next month.
* A handout picture released by the Iraqi prime minister's press office on July 9, 2017, shows Iraqi Prime Minister Haider al-Abadi (C-R) shaking hands with army officers upon his arrival in Mosul. (AFP)
But the fight grew tougher when Iraqi forces entered the densely populated Old City on the western bank of the Tigris River that divides the city.
In recent days, security forces have killed jihadists trying to escape their dwindling foothold in Mosul, as Iraqi units fought to retake the last two Daesh-held areas near the Tigris.
Earlier Sunday Iraq's Joint Operations Command had said it 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 those who fled arrived grief-stricken after losing relatives in jihadist sniper fire and bombardments.
* A handout picture released by the Iraqi prime minister's press office on July 9, 2017, shows Iraqi Prime Minister Haider al-Abadi (3rd from R) walking alongside police and army officers upon his arrival in Mosul. (AFP)
Around 915,000 residents have fled Mosul since the start of the battle for the city in October, the United Nations said this week.
Iraqi forces are backed by air strikes and advisers of the US-led coalition fighting Daesh in Iraq and Syria since 2014.
Abadi declared on Twitter late last month that "we are seeing the end of the fake (Daesh) state".
The recapture of Mosul will not however mark the end of the threat posed by Daesh, which holds territory elsewhere in Iraq and is able to carry out frequent bombings in government-held areas.
In Syria, a US-backed Kurdish-Arab alliance is fighting to oust the jihadist group from the northern city of Raqa after penetrating its heavily fortified historic centre.