Lt Gen Stephen Townsend is the commander of the US-led operation against IS

The senior US commander in Iraq has warned that the war against the so-called Islamic State (IS) is not over, despite a "historic" victory in Mosul.

Lt Gen Stephen Townsend told the BBC there were still IS fighters in Iraq.

He said the government should now reach out to Iraq’s Sunnis to stop the jihadist group from renewing itself.

"If we’re to keep… ISIS 2.0 from emerging, the Iraqi government is going to have to do something pretty significantly different," he said.

"They’re going to have to reach out and reconcile with the Sunni population, and make them feel like their government in Baghdad represents them."

Iraq’s Prime Minister Haider al-Abadi has formally declared victory over IS in Mosul, after a nearly nine-month battle that left large areas in ruins, killed thousands of civilians and displaced more than 920,000 others.

Mr Abadi waved a national flag with troops after announcing the "collapse of the terrorist state of falsehood".

In a report on Tuesday, Amnesty International said Iraqi and coalition forces had used unnecessarily powerful weapons in densely-populated areas.

IS fighters were also accused by Amnesty of committing serious abuses.

Haider al-Abadi (centre) waved an Iraqi national flag as he celebrated with troops in Mosul

Commanders from the US-led coalition that has provided air and ground support to Iraqi forces said the urban combat had been most intense since World War Two.

Mr Abadi made the declaration of victory at the operations room of the Counter-Terrorism Service, whose elite forces were the first to enter Mosul in November.

Using a pejorative term for IS based on an Arabic acronym of its former name, he said: "I announce from here the end and the failure and the collapse of the terrorist state of falsehood and terrorism, which the terrorist Daesh announced from Mosul."

US President Donald Trump sent his congratulations to his Iraqi counterpart, saying Mosul had been "liberated from its long nightmare under the rule of ISIS".

"We mourn the thousands of Iraqis brutally killed by ISIS and the millions of Iraqis who suffered," the president said in a statement, promising to seek the "total destruction" of the jihadists.

Enable it in your browser or download Flash Player here.Sorry, you need Flash to play this.Media captionSoldiers and police officers cheered as PM Abadi joined the celebrations

The US-led coalition confirmed that while areas of the Old City still had to be cleared of explosive devices and possible IS fighters in hiding, the Iraqi security forces had Mosul "firmly under their control".

Mr Abadi had to delay declaring the "liberation" of Mosul on Sunday because a pocket of resistance remained in the Old City, on the western bank of the River Tigris, that was only about 180m (200 yards) long and 45m wide.

Iraqi army officers believed only a few dozen militants were left inside along with their wives and children, who they said were being used as human shields.

Gunfire and explosions were heard coming from the area earlier on Monday.

Mosul has been devastated by the battle, with the UN estimating that more than 5,000 buildings have been damaged and 490 destroyed in the Old City alone.

The UN says 5,000 buildings have been damaged and 490 destroyed in the Old City alone Enable it in your browser or download Flash Player here.Sorry, you need Flash to play this.Media captionThe BBC reports from Mosul where rescue teams are searching for survivors

"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 the UN Humanitarian Coordinator in Iraq, Lise Grande.

"Many of the people who have fled have lost everything. They need shelter, food, health care, water, sanitation and emergency kits. The levels of trauma we are seeing are some of the highest anywhere. What people have experienced is nearly unimaginable."

IS militants overran Mosul in June 2014, before seizing control of large parts of northern and western Iraq. The following month, Abu Bakr al-Baghdadi made his first and only public appearance as IS leader at the city’s Great Mosque of al-Nuri, and gave a speech proclaiming the creation of a "caliphate".

IS blew up the mosque almost exactly three years later as Iraqi troops prepared to retake it – a move Iraq’s prime minister called a "formal declaration of defeat".

The BBC’s Jonathan Beale in Mosul says the jihadists may have lost militarily in the city, but this is not their end in Iraq nor the end of their twisted ideology.

IS still controls territory in three areas of Iraq – around Hawija, 130km (80 miles) south-east of Mosul, around Tal Afar, 65km west, and from Ana to Al-Qaim in the Euphrates river valley, 250km to the south-west.

It also holds a string of towns along the Euphrates in Syria, including Albu Kamal and Mayadin, but its stronghold of Raqqa is besieged by US-backed fighters.