The capture of the government complex came after weeks of fighting. Photo: AP
The Iraqi city of Ramadi has been "liberated" from so-called Islamic State, the Iraqi military has declared.
Spokesman Brig Gen Yahya Rasul said forces had achieved an "epic" victory and that the Iraqi flag had been raised over the government complex there.
Some reports indicate there are still pockets of resistance in the city.
Ramadi's recapture would mark a major reversal for the jihadist group. They had seized it in May, in an embarrassing defeat for the army.
Iraqi government forces had been fighting to retake it for weeks.
Troops managed to capture the government compound on Sunday, flushing out or killing Islamic State (IS) fighters and suicide bombers who had been holding out in the buildings. Brig Gen Majid al-Fatlawi of the army's 8th division told AFP that IS fighters had "planted more than 300 explosive devices on the roads and in the buildings of the government complex".
Despite the declaration of victory, the head of military operations in Anbar, Gen Ismail al-Mahlawi, said retreating IS militants still controlled parts of the city, the Associated Press news agency reported.
The operation to recapture Ramadi, about 55 miles (90km) west of Baghdad, began in early November.
It was backed by US-led coalition air strikes. But it made slow progress, mainly because the government chose not to use the powerful Shia-dominated paramilitary force that helped it regain the mainly Sunni northern city of Tikrit, to avoid increasing sectarian tensions. The US military called the recapture a "proud moment for Iraq".
It added that "the coalition will continue to support the government of Iraq as they move forward to make Ramadi safe for civilians to return".