Iraq said security and allied forces backed by US-led coalition aircraft "liberated" the city of Tikrit on Tuesday, its biggest victory yet in the fight against Islamic State jihadists.
The operation to retake the hometown of former president Saddam Hussein began on March 2 and had looked bogged down before Iraqi forces made rapid advances over the past 48 hours.
Prime Minister Haider al-Abadi "announces the liberation of Tikrit and congratulates Iraqi security forces and popular volunteers on the historic milestone," his official Twitter account said.
He was referring to paramilitary groups which played a major role in the fighting to retake Tikrit, a Sunni Arab city which IS had controlled since it captured swathes of Iraq in June.
Iraqiya state television showed footage of houses previously used by IS in liberated areas but it was not clear whether any pockets of resistance remained.
The provincial government headquarters was retaken on Monday and on Tuesday the Iraqi tricolour replaced the black IS flag on the building.
In a statement to AFP just minutes before Abadi's tweet, his spokesman Rafid Jaboori said: "Iraqi forces reached the centre of Tikrit, raised the Iraqi flag and are now clearing the city."
Iraqi military officials have been saying since the start of the operation that IS fighters had laid thousands of bombs in streets, houses and tunnels to make their last stand.
There no immediate information on how many fighters were killed, wounded or captured in the fighting.
The government has not provided any casualty figures since the operation started a month ago.
Iraqi army and police forces, as well as volunteers and Iran-backed Shiite militias, completely surrounded Tikrit within two weeks of launching the operation.
There was a lull in fighting when government and allied forces apparently balked at the number of snipers, booby traps, berms and trenches which IS was using to defend its city centre redoubt.
Iran was Baghdad's top foreign partner in the early stages of the operation but Iraqi air force strikes were proving insufficient to break the back of IS resistance.
Abadi's government eventually requested strikes from the US-led coalition which has been assisting Iraqi forces elsewhere in the country since August last year.
US jets began bombing IS targets in Tikrit on March 25. France also took part in the campaign.
The move sparked a freeze in the participation of the Popular Mobilisation units, an umbrella organisation for volunteers and militias which accounted for the bulk of the manpower involved in the Tikrit battle.
The Pentagon had expressed unease at the role played by Iran and its proxies in the battle and said it conditioned its intervention on regular forces taking the lead.
On Friday, it hailed the withdrawal from the fight of "those Shiite militias who are linked to, infiltrated by, (or) otherwise under the influence of Iran".
But after giving themselves political cover by declaring that they do not want to work with each other, both sides took part in the Tikrit operation this week.
Tikrit, which once had an estimated population of around 200,000, had been largely emptied of civilians by the time the government operation was launched at the start of March.
The fate of those who were believed to have remained in the city was unclear Tuesday.
Thousands of people displaced last year or more recently from Salaheddin province, of which Tikrit is the capital, have started returning to their homes in outlying liberated areas.
But the level of destruction Tikrit is believed to have suffered and the threat posed by unexploded bombs mean residents of the city itself could take longer to return.
Tikrit holds both strategic and symbolic importance.
It was the hometown of executed dictator Saddam Hussein, remnants of whose Baath party collaborated with IS last summer.
Iraqi forces had since June tried and failed several times to retake the city, seen as a key stepping stone to recapturing Mosul, the jihadists' largest hub in Iraq.