By Maher Chmaytelli and Ahmed Aboulenein
BAGHDAD (Reuters) - Prime Minister Haider al-Abadi declared final victory over Islamic State 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 Islamic State 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.
"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."
Daesh is an Arabic acronym for Islamic State, also known as ISIS.
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 Islamic State.
Abadi declared Dec. 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 U.S.-led coalition that has been supporting the Iraqi forces against Islamic State welcomed the news, as did Brett McGurk, the U.S. 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 honour 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 U.S. State Department also issued a statement of congratulation.
Mosul, the group's de facto capital in Iraq, fell in July after a gruelling nine-month campaign backed by a U.S.-led coalition that saw much of the northern Iraqi city destroyed.
Islamic State's Syrian capital Raqqa also fell to a U.S.-backed Kurdish-led coalition in September.
The forces fighting Islamic State in Iraq and Syria now expect a new phase of guerrilla warfare, a tactic the militants have already shown themselves capable of.
Abadi said Iraq had entered "the post-victory over Daesh phase" and must be prepared for future threats.
"Daesh's dream is over and we must erase all its effect and not allow terrorism to return. Despite announcing final victory, we must remain vigilant and prepared against any terrorist attempt on our country, for terrorism is an eternal enemy."
The war has had a devastating impact on the areas previously controlled by the militants. About 3.2 million people remain displaced, a U.N. statement said on Saturday.
Islamic State leader Abu Bakr al-Baghdadi, who in 2014 declared in Mosul the founding of a new Islamic caliphate in Iraq and Syria, released an audio recording on Sept. 28 indicating he was alive following several reports of his death. He urged his followers to keep up the fight despite setbacks.
Baghdadi is believed to be hiding in the stretch of desert in the border area.
His followers imposed a reign of terror on the populations they controlled, alienating even many of those Sunni Muslims who had supported the group as allies against the heavy-handed rule of the Shi'ite majority-led government of the time.
The militants took thousands of women from the Yazidi minority, which lives in a mountain west of Mosul, as sex slaves and killed the men.
Driven from Mosul and Raqqa, Islamic State was progressively squeezed this year into an ever-shrinking pocket of desert, straddling the frontier between the two countries, by enemies that include regional states and global powers.
In Iraq, the group faced mainly U.S.-backed Iraqi government forces and Kurdish Peshmerga fighters, and Iranian-trained Shi'ite paramilitaries known as Popular Mobilisation.
Abadi praised the Popular Mobilisation Forces (PMF) and Iraq's top Shi'ite cleric Grand Ayatollah Ali al-Sistani, whose fatwa calling volunteers to fight Islamic State led to PMF's creation.
Still, the prime minister said the state should have a monopoly on the use of arms. Disarming the PMF is seen as Abadi's most difficult test after Islamic State's defeat.
"Weapons should only be in the state's hands. The rule of law and respect for it are the way to build the state and achieve justice, equality, and stability," he said.
Abadi called for unity, which he said was the main reason for the victory, a reference to the contribution of different communities, including Sunni tribal fighters.
However, Iraq faces a fresh internal conflict after it retaliated economically and militarily against the semi-autonomous Kurdistan Regional Government for holding a referendum on independence despite Baghdad's opposition.
"The joy of victory is complete with Iraq's unity after it was on the verge of division. The unity of Iraq and its people is the most important and greatest accomplishment," he said.
(Reporting by Maher Chmaytelli and Ahmed Aboulenein; Editing by Gareth Jones and Edmund Blair)