Iraq declared the city of Ramadi liberated from the Islamic State group on Monday and raised the national flag over its government complex after clinching a landmark victory against the jihadists.
Fighters brandishing rifles danced in the Anbar provincial capital as top commanders paraded through the streets after recapturing the city they lost to IS in May.
Pockets of jihadists may remain but the army said it no longer faced any resistance and that its main task was to defuse the countless bombs and traps IS left behind.
"Ramadi has been liberated and the armed forces of the counter-terrorism service have raised the Iraqi flag above the government complex," Brigadier General Yahya Rasool announced on state television.
The former government headquarters in Ramadi was the epicentre of the fighting but Iraqi forces did not rush in when IS pulled out because the entire area was rigged.
"Daesh has planted more than 300 explosive devices on the roads and in the buildings of the government complex," said Brigadier General Majid al-Fatlawi of the army's 8th division.
Several local officials said IS used civilians as human shields to escape the battle when it became clear their last stand in Ramadi was doomed.
Updated map showing the battle for Ramadi, where Iraqi government troops began to extend their control over the city on Sunday.
A senior army commander told AFP that his forces were still sweeping the outskirts of the city for potential pockets of jihadists.
IS had an estimated force of around 400 fighters to defend central Ramadi a week ago. It is not clear how many were killed and how many were able to pull back to positions outside the city.
The Iraqi authorities did not divulge any casualty figures for federal forces but medics told AFP that close to 100 wounded government fighters were brought to Baghdad hospitals on Sunday alone.
"The dead bodies are taken directly to the main military hospital" near the airport, said one hospital source, explaining why he could not provide a death toll.
The US-led anti-IS coalition praised the performance of the Iraqi forces in retaking Ramadi, an operation in which it played a significant role, training local forces, arming them and carrying out what it said were 600 air strikes since July.
French President Francois Hollande called the liberation of Ramadi the "most important victory yet" in the fight against the jihadists.
Germany's Foreign Minister Frank-Walter Steinmeier said "it shows once again that IS is not unbeatable".
The jihadists' loss of Ramadi came on the heels of the recapture in neighbouring Syria of a key dam on the Euphrates by an alliance of Kurdish and Arab rebels.
Members of Iraq's elite counter-terrorism service secure the Hoz neighbourhood in central Ramadi on December 27, 2015.
The speaker parliament was one of the first top Iraqi officials to congratulate the security forces on their victory.
"This great victory has broken the back of Daesh and represents a launchpad for the liberation of Nineveh," Salim al-Juburi said in a statement.
Nineveh is home to Iraq's second city of Mosul, from which IS chief Abu Bakr al-Baghdadi proclaimed his "caliphate" straddling Iraq and Syria more than a year and a half ago.
Boost for army
Anbar residents account for more than a third of the 3.2 million Iraqis who have been displaced by conflict since the start of 2014.
Ramadi is devastated and a return to normalcy is some way away.
Sohaib Ali, 27, fled with his three children and the rest of his family to the capital of the autonomous Kurdish region Arbil nearly two years ago when violence first hit Ramadi.
"We do not intend to return for now, although this liberation makes us very happy. We can see that huge damage was caused in the city and I don't think that basic services will return for a while, nor will security," he said.
Members of Iraq's elite counter-terrorism service secure on December 27, 2015 the Hoz neighbourhood in central Ramadi.
Iraq's defence minister, Khaled al-Obeidi, said a week ago that Iraqi forces had reconquered more than half of the territory lost to IS in June and August 2014.
The victory in Ramadi follows others in Baiji, north of Baghdad, and Sinjar, the hub of the Yazidi minority in the northeast of the country.
Ramadi was recaptured by federal forces, with the Popular Mobilisation -- a paramilitary force dominated by Tehran-backed Shiite militia groups -- remaining on the fringes.
Many of Prime Minister Haider al-Abadi's political rivals had questioned his strategy of excluding those groups and relying on the US-led coalition's air power.
"The prestige goes to the Iraqi military," said political analyst Ihsan al-Shammari.
"As an institution, it's the first time since the Daesh invasion (in June 2014) it has achieved a victory without the support of the Popular Mobilisation force," he said.
The Iraq army collapsed when IS attacked Mosul in June 2014 and swept across Iraq's Sunni Arab heartland virtually unopposed.