Iraqi Prime Minister Haider al-Abadi has urged all Iraqis to celebrate the recapture of Fallujah during a visit to the city and has vowed the national flag will be raised in Mosul soon.

Iraqi forces took the last positions of the Islamic State of Iraq and the Levant (ISIL, also known as ISIS) in Fallujah on Sunday, establishing full control over one of the group's most emblematic bastions after a month-long operation.

"I call on all Iraqis wherever they are to get out and celebrate," he told Iraqiya state television, standing in front of Fallujah's main hospital with an Iraqi flag around his neck.

Abadi had already declared victory on June 17 after ISIL defences collapsed, with Iraqi forces facing only limited resistance in subsequent clearing operations.

If true, Mosul, Iraq's second city, is the last remaining major hub of ISIL following the recapture of Fallujah.

Timeline: The battle for Fallujah

The offensive saw tens of thousands of civilians risk death to flee their homes, leaving Iraq to grapple with a humanitarian crisis as its forces prepare to attack Mosul.

WATCH: Iraqi army claims victory over ISIL in Fallujah

Victory for the security forces in Fallujah came when elite forces retook Jolan, a northwestern neighbourhood where the last ISIL fighters in the city were believed to be holed up.

Sabah al-Noman, spokesman for Iraq's elite Counterterrorism Service, that has been leading the fight, said: "It did not take more than two hours for CTS to retake Jolan." 

"Daesh did not fire a single bullet," he said, using an Arabic acronym for ISIL. "This proves that Daesh was defeated even before our forces got there."

Several other senior military commanders said only small pockets of ISIL fighters remained in the Fallujah area.

READ MORE: Fallujah's displaced endure 'inhuman' conditions

Fallujah, in Anbar province, has been under the control of ISIL since January 2014.

The city, about 65km west of the capital Baghdad, was the first city to fall to the group.

Bloody battlefield

During a battle waged by ISIL's predecessor, al-Qaeda in Iraq, Fallujah was the scene of some of the bloodiest urban combat with American forces.

In 2004, more than 100 US troops died and another 1,000 were wounded fighting armed rebels in house-to-house battles.

ISIL fighters still control significant areas in northern and western Iraq, including the country's second-largest city of Mosul.

Fallujah civilians: 'Militias take turns to torture us'

ISIL declared an Islamic "caliphate" on the territory it holds in Iraq and Syria and at the height of its power was estimated to hold nearly a third of each country.

The latest government offensive began on May 23 and has displaced more than 60,000 people, with most people forced to fend for themselves.

"They have been eating rotten dates and animal feed - and drinking from the river, which is undrinkable" Karl Schembri, of the Norwegian Refugee Council, earlier told Al Jazeera, explaining that the city was already enduring difficult humanitarian conditions.

More than 3.4 million Iraqis have been displaced since January 2014, according to UNHCR, the UN refugee agency.

What’s the importance of Fallujah?

Source: Al Jazeera and agencies