Prime Minister Haider al-Abadi declared final victory over Daesh on Saturday after Iraqi forces drove its last remnants from the country, three years after the militant group captured about a third of Iraq's territory.
The announcement comes two days after the Russian military announced the defeat of the militants in neighbouring Syria, where Moscow is backing Syrian government forces.
Iraqi forces recaptured the last areas still under Daesh control along the border with Syria, the military said.
"Honourable Iraqis: your land has been completely liberated. The dream of liberation is now a reality," Abadi said in a televised address. He was speaking with five Iraqi flags and dozens of servicemen from different branches behind him, saying:
We have accomplished a very difficult mission. Our heroes have reached the final strongholds of Daesh and purified it. The Iraqi flag flies high today over all Iraqi lands.
Several squadrons of Iraqi helicopters flew over Baghdad carrying Iraqi flags at noon, in an apparent rehearsal for a victory parade that Iraq is planning to hold in coming days.
The government said the declaration meant Iraqi forces had secured the western desert and the entire Iraq-Syria border, and marked the end of the war against Daesh.
Abadi declared December 10 a national holiday to be celebrated every year. State television aired celebratory songs praising government forces and militias, and showed scenes of celebration on the streets of Baghdad and other provinces.
The US-led coalition that has been supporting the Iraqi forces against Daesh welcomed the news, as did Brett McGurk, the US Special Presidential Envoy to the coalition.
"We congratulate the Prime Minister and all the Iraqi people on this significant achievement, which many thought impossible," he said in a series of tweets.
"We honor the sacrifices of the Iraqi people, its security forces, and the Kurdish Peshmerga, and admire the unity in their ranks that had made this day possible."
The US State Department also issued a statement of congratulation.