(AFP) -- Three years after the Islamic State group routed them in Mosul, Iraqi forces are now on the cusp of retaking the city from the jihadists and avenging a historic debacle.
The fall of Mosul was the worst defeat that Iraqi forces suffered in the war with IS, and regaining it would cap a major turnaround for security forces that broke and ran despite outnumbering the jihadists who attacked the second city in 2014.
"Of course, we celebrate the successes of the military" three years after the city's fall, said Staff Lieutenant General Abdulghani al-Assadi, a senior commander in Iraq's elite Counter-Terrorism Service, which has spearheaded the battle.
When IS seized Mosul on June 10, 2014 and drove south toward the federal capital, the atmosphere was not one of celebration, but rather fear.
"Three years ago, around this time, Daesh... was moving rapidly towards Baghdad," said Brett McGurk, the US envoy to the international coalition against IS, using an Arabic acronym for the jihadist group.
"Mosul fell, seven divisions of the Iraqi security forces simply disintegrated," he said.
Iraqi forces "were not prepared for a threat like that" posed by IS in 2014, said coalition spokesman Colonel Ryan Dillon.
IS "was knocking on the doors of Baghdad."
At that time, recovery "looked almost impossible, and many were saying, 'Well, this is the end of Iraq'", McGurk said.
A combination of factors ultimately stopped the jihadists short of Baghdad, and they were not able to launch a large-scale conventional attack on the capital.
Grand Ayatollah Ali al-Sistani, the country's top Shiite cleric, called for volunteers to battle IS, and pre-existing Iran-backed Shiite militias fought under that banner to first halt the jihadists and then slowly push them back, while new volunteer units were also established.
The United States meanwhile launched an air campaign against IS in Iraq about two months after Mosul's fall, which became an international coalition effort also involving training and other support for Iraqi forces.
- Better, but still flawed -
The Iraqi security forces have since recaptured much of the territory seized by IS, including three cities, and have retaken most of Mosul, the fourth and largest.
In Mosul, "nothing remains for Daesh except three or four neighbourhoods in which it is surrounded," Assadi said.
When IS seized Mosul, "the units that were present were in fact lacking some preparations and some equipment... and therefore the fall (of the city) happened quickly," he said.
"Now the units are well prepared and their relationship with the citizen -- and this is a very important point -- is a good relationship and the citizen cooperates with the units," Assadi said.
"Success in the Mosul operation will highlight how far the Iraqi Security Forces (ISF) have come since their collapse in June 2014," said Patrick Martin, Iraq analyst at the Institute for the Study of War.
But Martin noted that "recapturing terrain in Mosul should not obscure the fact that the ISF remains incomplete and flawed," including that "they still have insufficient manpower to clear and hold the country."
Pushing the jihadists back has taken a massive toll on Iraq: years of battles have left thousands dead and hundreds of thousands displaced, and laid waste to swathes of the country, while many suffered under brutal jihadist rule.
"Nineveh province in general and Mosul specifically passed through a major tragedy," said Staff Lieutenant General Abdulwahab al-Saadi, another senior Counter-Terrorism Service commander.
Civilians suffered through massacres and rapes, while a "very big price (was) paid by all the units" that fought, Saadi said.
The recapture of Mosul will also not mark the end of the war against IS in Iraq, as the jihadists will still control territory in Kirkuk province further south as well as in the west.
And then there is the "future threat", Dillon said, that IS "will devolve back into an insurgency again."