US-backed Iraqi forces pressed so-called Islamic State fighters holding out in Mosul's Old City today, while in Syria the militant group launched a counter-attack against an alliance of militias trying to oust it from its de facto capital of Raqqa.

In Iraq, dozens of civilians poured out of Mosul, long held by IS, and fled in the direction of the Iraqi forces.

Iraqi authorities said they are only days away from a victory over militants in Mosul, though commanders of counter-terrorism units fighting their way through the narrow streets of the Old City said die-hard IS fighters are dug in among civilians and the battle ahead remains challenging.

Across the border in Syria, parts of which IS said fall under its self-proclaimed caliphate, the picture was more complex.

The Syrian Observatory for Human Rights, a Britain-based war monitor, said the group had retaken most of the industrial district of Raqqa after mounting a fierce counter-attack against the Syrian Democratic Forces (SDF), a US-backed alliance of Kurdish and Arab militias.

IS has launched a counter-attack against an alliance of militias in Raqqa

But west of Raqqa, the Syrian army put the group under more pressure, driving it from its last territory in Aleppo province, a Syrian military source said, in a strategically important move that relieves pressure on a government supply route.

Even though the IS group is under pressure in these urban strongholds in Iraq and Syria, its fighters still occupy an area as big as Belgium across the two countries, according to one estimate.

In Iraq, grinding warfare in Mosul has displaced 900,000 people, about half the city's pre-war population, and killed thousands of civilians, according to aid organisations.

Tens of thousands of civilians are trapped in the city in desperate conditions, with dwindling supplies of food, water or medicine and no access to health services, according to those who have managed to flee.

The capture of the city would in effect mark the end of the Iraqi half of the caliphate, although the group still controls territory west and south of the city, holding sway over hundreds of thousands of people.

Those who escaped today streamed through alleyways near the Grand al-Nuri Mosque, where IS leader Abu Bakr al-Baghdadi declared the caliphate in 2014 and which IS fighters blew up a week ago rather than see it fall to the Iraqi army.

Iraqi Prime Minister Haider al-Abadi declared the end of the caliphate yesterday after soldiers captured the ground of the ruined 850-year-old mosque.

A Reuters correspondent saw smoke billowing over the riverside districts amid artillery blasts and burst of gunfire today. Western troops from the US-led coalition were helping adjust artillery fire with air surveillance, he said.

The SDF, the US-backed alliance in Syria, took the industrial district of Raqqa this month in its biggest gain so far in its fight for IS's Syrian capital and if, as the Observatory has reported, IS has regained control there it would be a setback.

The SDF, on its social media feed, acknowledged there had been intense clashes, but added that the whole industrial district was still in its hands and the attack had been thwarted.

Equally, IS appeared to have suffered a setback in Syria with the army taking the last stretch of the Ithriya-Rasafa road, part of the highway from Hama to Raqqa, forcing IS fighters to withdraw from a salient it held to the north, a Syrian military source and the Observatory said.