MOSUL, Iraq (AFP) — Iraqi Prime Minister Haider al-Abadi declared a victory over “brutality and terrorism” in Mosul on Monday after his forces ended the Islamic State terror group’s rule over the country’s second city.

Flanked by soldiers, Abadi hailed the retaking of Mosul — from where IS declared its self-styled “caliphate” three years ago — as a historic moment in the battle against the jihadists.

“Our victory today is a victory over darkness, a victory over brutality and terrorism, and I announce to the whole world today the end and failure and collapse of the mythical terrorist state,” Abadi said in a televised address from west Mosul.

The US-led coalition that backed the Mosul offensive and is supporting another assault on IS’s Syrian bastion Raqqa hailed the victory, but warned it did not mark the end of the war against the jihadists.

“This victory alone does not eliminate (IS) and there is still a tough fight ahead. But the loss of one of its twin capitals and a jewel of their so-called caliphate is a decisive blow,” Lieutenant General Stephen Townsend, the commander of the operation, said in a statement.

Iraqi forces earlier on Monday were still fighting to eliminate the last pockets of IS resistance in Mosul, with jihadist fighters surrounded in a sliver of territory in Mosul’s Old City.

Attention was also turning to the huge task of rebuilding and helping civilians, with aid groups warning that Iraq’s humanitarian crisis was far from over.

Devastation in Old City

Mosul’s Old City in particular has been devastated, with many buildings reduced to little more than concrete shells and rubble littering the streets.

Abadi said that as well as continuing to tackle IS, Iraq had other challenges including “the mission of stabilization and the mission of building.”

A senior commander said on Monday that Iraqi forces were still engaged in “heavy” fighting with the remnants of jihadist forces, but that the battle was near its end.

Soldiers armed with machine guns and sniper rifles fired from atop ruined structures in the Old City on Monday, and air strikes sent plumes of smoke rising over Mosul’s historic center.

Lieutenant General Sami al-Aridhi of Iraq’s elite Counter-Terrorism Service said the jihadists had been reduced to an area of the Old City of about 200 by 100 meters.

“They do not accept to surrender,” Aridhi told AFP.

But “operations are in their final stages,” and “it is likely that (the fighting) will end today,” he said.

Aridhi said his forces had information that there were between 3,000 and 4,000 civilians in the area, but that could not be independently confirmed.

Backed by the US-led coalition, Iraqi forces launched their campaign in October to retake Mosul, which had been seized by the jihadists during the mid-2014 offensive that saw them take control of large parts of Iraq and neighboring Syria.

Army, police and special forces, backed by waves of US-led air strikes, seized the eastern side of the city in January and launched the battle for its western part the next month.

The fight grew tougher when security forces entered the densely populated Old City on the western bank of the Tigris River, which divides the city, and intense street-to-street fighting followed.

The cost of victory has been enormous: much of Mosul in ruins, thousands dead and wounded and nearly half the city’s population forced from their homes.

The United Nations has said 920,000 people fled their homes during the Mosul operation, and while some have returned, the vast majority remain displaced.

“It’s a relief to know that the military campaign in Mosul is ending. The fighting may be over, but the humanitarian crisis is not,” said Lise Grande, the UN’s humanitarian coordinator in Iraq.

The UN refugee agency (UNHCR) on Monday said it could be many months before civilians are able to return to their homes.

“It is likely that thousands of people may have to remain in displacement for months to come,” the UNHCR said.

‘Nothing to go back to’

“Many have nothing to go back to due to extensive damage caused during the conflict, while key basic services such as water, electricity and other key infrastructure, including schools and hospitals, will need to be rebuilt or repaired,” it said.

Twenty-eight aid groups working in Iraq issued a statement calling for international support for rebuilding efforts and urged authorities not to press civilians to return.

“Remaining insecurity; lack of basic services; explosive hazards contamination; and damage to homes, businesses and public infrastructure — including schools and hospitals — all continue to pose barriers to return,” said the statement signed by groups including the Norwegian Refugee Council, Oxfam and Save the Children.

It also raised concerns for Iraqis still in areas under IS control, including the towns of Tal Afar and Hawijah in the north, as well as territory in western Anbar province.

“For the expected offensives in Hawijah, Tal Afar and western Anbar, where approximately 150,000 civilians are thought to still be trapped, it is vital that lessons are learnt from pass offensives,” they said, calling for access to safety and assistance to be prioritized.

France, Britain and the European Union congratulated Iraqi forces on Sunday, with the EU hailing “a decisive step in the campaign to eliminate terrorist control in parts of Iraq.”

Iran, a key ally of Abadi’s Shiite-led government, gave its congratulations too and offered help in rebuilding.

IS has lost most of the territory it once controlled, and the coalition is also aiming to oust the jihadists from their Syrian stronghold Raqqa, which is under assault by US-backed Arab and Kurdish forces.