Iraq declared the city of Ramadi liberated from the Islamic State group 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 lost to IS in May.
Pockets of jihadists may remain, but the army said it no longer faced any resistance in the city and that its main task was to defuse countless bombs and traps.
"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 said on television.
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.
Iraqi Prime Minister Haider al-Abadi congratulated the fighters who retook Ramadi, vowing to liberate the second city of Mosul and rid the entire country of IS in 2016.
"We are coming to liberate Mosul, which will be the fatal blow to Daesh," he said in a televised address.
The US-led coalition against IS, which has backed the fight against the jihadists by training and arming local forces and with hundreds of air strikes, hailed the Iraqi forces for taking the city.
"We commend the government of Iraq and the brave Iraqi forces that are displaying tremendous perseverance and courage in this fight," US Secretary of State John Kerry said.
- 'Roll back ISIL' -
Iraq has not divulged any casualty figures for federal forces but medics said close to 100 government fighters were brought to Baghdad hospitals on Sunday alone.
Officials said IS used civilians as human shields to escape the battle when it became clear their last stand in Ramadi was doomed.
IS had an estimated force of about 400 fighters to defend central Ramadi a week ago. It is unclear how many were killed and how many were able to pull back.
A senior army commander said his forces were sweeping the outskirts of the city for potential pockets of jihadists.
General Lloyd Austin, head of US Central Command which is overseeing the US role in the campaign, said Ramadi's fall "clearly demonstrates that the enemy is losing momentum as they steadily cede territory".
Signup to our newsletter and follow us on Facebook and Twitter!
"I expect our partners on the ground in both Iraq and Syria, with coalition assistance, to continue to roll back ISIL gains," he added, using another name for IS.
Iraqi forces have not yet rushed into the former government headquarters that were the epicentre of the fighting, fearing booby traps.
"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.
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".
- Boost for army -
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.
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.
It will help boost Iraq's much-criticised military, which collapsed when IS took over large parts of the country in June 2014.
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."