Iraqi troops have celebrated after driving Islamic State militants from some of their last strongholds in Mosul, but heavy fighting continued a few blocks away.

Lieutenant General Jassim Nizal of the army's 9th Division said his forces had achieved "victory" in their sector, after a similar announcement by the militarised Federal Police.

His soldiers danced to patriotic music on tanks even as air strikes sent plumes of smoke into the air nearby.

Iraqi state TV reported that prime minister Haider al-Abadi had arrived in the city to declare victory over IS in the eight-month operation to drive the militants out of the city.

State TV quoted Mr al-Abadi as saying he "congratulates the fighters and the people on the big victory" in the key city, even as fighting continued in a small sector in the city.

Iraq launched the operation to retake Mosul in October. IS now controls less than a square kilometre of territory in the Old City, but is using human shields, suicide bombers and snipers in a fight to the death.

The militants captured Iraq's second largest city in a matter of days in the summer of 2014. Lt Gen Nizal acknowledged that many of his men were among those who fled the city at that time in a humiliating defeat for the country's armed forces.

Much of Mosul's Old City and surrounding areas have been devastated by months of gruelling urban combat. On Sunday a line of tired civilians filed out of the Old City on foot, past destroyed apartment blocks lining the cratered roads.

The loss of the city would mark a major defeat for IS, which has suffered a series of major setbacks over the past year.

US-backed Syrian forces have pushed into the group's de facto capital, the northern Syrian city of Raqqa, but a final victory there could be months away, and the extremists still hold several smaller towns and villages across Iraq and Syria.