Iraq's army declared victory over Islamic State fighters in a provincial capital west of Baghdad on Sunday, the first major triumph for the US-trained force since it collapsed in the face of an assault by the militants 18 months ago.
The capture of Ramadi, capital of mainly Sunni-Muslim Anbar province in the Euphrates River valley west of the capital, deprives Islamic State militants of their biggest prize of 2015. The fighters seized it in May after government troops fled in a defeat which prompted Washington to take a hard look at strategy in its ongoing air war against the militants.
After encircling the city for weeks, the Iraqi military launched a campaign to retake it last week, and made a final push to seize the central administration complex on Sunday. "By controlling the complex this means that we have defeated them in Ramadi," said Sabah al-Numani, a spokesman for the force leading the fight on the government side. "The next step is to clear pockets that could exist here or there in the city."
State television broadcast footage of troops, Humvee vehicles and tanks advancing through Ramadi streets amid piles of rubble and collapsed houses. Some districts appeared to have been completely destroyed by the advance.
Television also showed nighttime celebrations in mainly Shi'ite cities south of Baghdad for the victory in Anbar, with people dancing in the streets and waving Iraqi flags from cars.
Officials did not give any immediate death tolls for the battle. The government says most civilians were able to evacuate before it launched its assault.
Anbar provincial council member Falih al-Essawi called on the government to restore services to Ramadi quickly and start rebuilding the city to allow the return of the displaced.
"It will not be easy to convince families to return to a city that lacks basic human needs," he told Reuters.
Islamic State swept through a third of Iraq in June 2014 and declared a "caliphate" to rule over all Muslims from territory in both Iraq and Syria, carrying out mass killings and imposing a draconian form of Islam.
Its rise was aided by the swift collapse of the Iraqi army, which abandoned city after city, leaving fleets of armoured vehicles and other American weapons in the fighters' hands.
Since then, the battle against the group in both countries has drawn in most global and regional powers, often with competing allies on the ground in complex multi-sided civil wars.
A US-led coalition is waging an air campaign against Islamic State, but rebuilding the Iraqi army to the point that it could recapture and hold territory has been one of the biggest challenges.
In previous battles, including the recapture of former dictator Saddam Hussein's home city Tikrit in April, the Iraqi government relied on Iran-backed Shi'ite militias for ground fighting, with its own army mainly in a supporting role.
Ramadi was the first major city recaptured by the army itself, without relying on the militias, who were kept off the battlefield to avoid sectarian tension with the mainly Sunni population. The government, led by a Shi'ite Prime Minister, Haider al-Abadi, said Ramadi would be handed over to local police and a Sunni tribal force once it was secured, a measure meant to win over the community to the fight against Islamic State.
"We have trained hundreds of tribal fighters, their role will be holding the ground," said Brigadier-General Yahya Rasool, spokesman for the joint operations command.
"Seeing their own tribes responsible for security will be a relief for the civilians" and will help convince those who have been displaced to return to the city, he added.
The strategy echoes the "surge" campaign fought by US forces in 2006-2007 against a precursor of Islamic State, when Washington also relied on winning over local Sunni tribes and arming them to fight militants. Anbar province, including Ramadi, was one of the main battlefields during that campaign at the height of the 2003-2011 US Iraq war.
The government said the next target after Ramadi will be the northern city of Mosul, by far the largest population centre controlled by Islamic State in either Iraq or Syria.
"The smooth victory in Ramadi should be happy news for the residents of Mosul," spokesman Numani said. US officials had hoped Baghdad would launch an assault on Mosul during 2015, but this was put off after the fighters swept into Ramadi in May. Dislodging the militants from Mosul, which had a pre-war population close to 2 million, would effectively abolish their state structure in Iraq and deprive them of a major source of funding, which comes partly from oil and partly from fees and taxes on residents.