Islamic State militants seized Mosul in the summer of 2014 when they swept across northern and central Iraq. That summer, the group's leader, Abu Bakr al-Baghdadi, appeared at Mosul's al-Nuri Mosque and declared a caliphate on territory it seized in Iraq and Syria.
Iraq launched the operation to retake Mosul in October, backed by airstrikes from the U.S.-led coalition. The fierce battle has killed thousands and displaced more than 897,000 people.
Last month, as Iraqi troops closed in on Mosul's Old City, the militants destroyed the al-Nuri Mosque and its famous leaning minaret to deny the forces a symbolic triumph.
Lt. Gen. Jassim Nizal of the army's 9th Division said his forces achieved "victory" in their sector, after a similar announcement by the militarized Federal Police. His soldiers danced to patriotic music atop tanks even as airstrikes sent up plumes of smoke nearby.
Nizal acknowledged that many of his men were among those who fled the city when IS forces seized Mosul in 2014 in a humiliating defeat for the Iraqi armed forces.
"Some things happened here, that's true," he said. "But we have come back."
Iraq's Prime Minister Haider al-Abadi, center right, shakes hands with Lt. Gen. Raid Shaker Jawlat, center left, the commander of Iraqi federal police upon his arrival in Mosul, Iraq, Sunday, July 9, 2017. Backed by the U.S.-led coalition, Iraq launched the operation to retake Mosul from Islamic State militants in October.
Photo Credit: Iraqi Federal Police Press Office via AP
Much of the Old City and surrounding areas have been devastated by the grueling urban combat. On Sunday, a line of weary civilians walked out of the Old City, past the shells of destroyed apartment blocks lining the cratered roads.
Heba Walid held her sister-in-law's baby, which was born into war. The parents of the 6-month-old, along with 15 other family members, were killed last month when an airstrike hit their home. When Walid ran out of formula, she fed the baby a paste of crushed biscuits mixed with water.
U.S.-backed Syrian forces have encircled and pushed into the Islamic State's de facto capital of Raqqa in neighboring Syria after a month of fighting, although a long battle lies ahead.
Iraqi Army soldiers gather to celebrate their gains as their fight against Islamic State militants continues in the Old City of Mosul, Iraq, Sunday, July 9, 2017.
Photo Credit: Felipe Dana/AP
More than 2,000 militants are holed up with their families and tens of thousands of civilians in Raqqa's center, the city's most densely populated districts.
The extremists still hold several smaller towns and villages across Iraq and Syria.
Salaheddin reported from Baghdad. Associated Press writer Salar Salim in Mosul contributed.