The end to the battle of Mosul has finally been declared by Iraqi Prime Minister Haider al-Abadi, who visited the city to congratulate troops.
The battle for Mosul, which has displaced close to 1 million people, has been raging since October 17, 2016.
Islamic State took the city in 2014. Since then, numerous forces have joined the Iraqi Army in the fight, from US-led air strikes to Kurdish Peshmerga, Sunni Arab tribes and Shia militia.
As fighting closed in, besieged citizens were trapped in Islamic State (IS) held areas of the city. The United Nations says some have been used as human shields by IS.
While Iraqi-backed forces declared victory over east Mosul in January, progress has been slower in the city's west, which is characterised by densely packed, narrow streets which meant snipers and suicide bombers could easily target advancing troops.
More than 800,000 people have been displaced by the fighting, most taking refuge in nearby camps. At least 2,463 have been killed in the province since October, with the UN saying half the fatalities expected to be civilian.
While troops have begun celebrating, their victory is far from complete. The city will continue to face attacks from suicide bombers and guerrilla IS cells, and empty houses may be rigged with explosives.
From the top of a pulpit of the Grand al-Nuri Mosque in 2014, IS declared a vast caliphate. That ancient mosque was reduced to rubble by IS several weeks ago, one of their final acts of defiance in the city. The group claimed the mosque was destroyed by American forces.
In the country's north, near borders with Syria, Turkey and Iran, Mosul was considered an entry point to Iraq for fighters.
It's a significant strategic victory for Iraqi forces, as it was for IS in 2014.