Iraqi forces recaptured the last district held by Islamic State militants in the city of Fallujah on Sunday and the general commanding the operation declared the battle over after nearly five weeks of fighting.

Iraqi forces reached the centre of Fallujah last week but militants remained holed up in some parts of the city west of Baghdad, including in its Golan district, which Iraqi forces retook on Sunday.

The assault is part of a wider offensive by Iraqi forces against Islamic State militants who seized swathes of territory in 2014 but are now being driven back by an array of forces backed by a U.S.-led coalition.

Iraqi forces pushed into the centre of Fallujah about a week ago, retaking a government complex and the central hospital, but the U.S.-led coalition said ISIS had only been cleared from about a third of the city. (Thaier Al-Sudani/Reuters)

The success of the Fallujah operation launched on May 23 gives fresh momentum to Iraqi forces in the campaign to retake Mosul, the largest city anywhere in the militants' self-proclaimed caliphate spanning Iraq and Syria.

"As we promised you, today this flag is flying high in Fallujah and, God willing, it will soon fly in Mosul," said Prime Minister Haider al-Abadi, standing in front of Fallujah's main hospital waving the Iraqi flag.

The swift entry of Iraqi forces into central Fallujah last week surprised many who expected a drawn-out battle with Islamic State for the bastion of Sunni insurgency, where some of the toughest fighting of the U.S. occupation took place after 2003.

Lieutenant General Abdul Wahab al-Saidi, who was in charge of the operation, told state TV on Sunday that at least 1,800 Islamic State fighters had been killed in the operation to retake Fallujah and the rest had fled. Some militants were still holding out in buildings, he said.

A member of the Iraqi counterterrorism forces guards a captured ISIS weapons factory in Fallujah on June 23. (Thaier Al-Sudani/Reuters)

Iraqi forces are now dismantling bombs and booby-trapped houses, whilst pursuing militants who slipped out of the city from the northwest, Sabah al-Numani, a spokesman for the counter-terrorism forces that spearheaded the offensive, told Reuters.

The insurgents had put up limited resistance in Fallujah and folded after some of their commanders abandoned the fight.

Defence Minister Khalid al-Obeidi said on Twitter around 90 per cent of Fallujah remained "safe and habitable," comparing that favourably with the cities of Ramadi and Sinjar, which were recaptured from ISIS but badly damaged in the process.

Fighting to recapture the Iraqi city has forced more than 85,000 residents to flee to overwhelmed government-run camps. The United Nations says it has received allegations of abuse of civilians fleeing the city, including by members of Shia armed groups supporting the offensive.

The militants seized Fallujah in January 2014, six months before they declared a "caliphate" over parts of Syria and Iraq.

The mayor of Fallujah told Reuters that displaced families could return to the city within two months if the government and intentional aid agencies provided assistance.

"The city doesn't just require a rebuilding of its infrastructure but also serious rehabilitation of its society,"

said Esa al-Esawi.

"[ISIS] worked to brainwash people and we need serious programs by the international community to help people get rid of … deviant ideologies and restore their normal life."