Iraq has announced that its war against so-called Islamic State (IS) is over.
Prime Minister Haider al-Abadi told a conference in Baghdad that Iraqi troops were now in complete control of the Iraqi-Syrian border.
The border zone contained the last few areas IS held, following its loss of the town of Rawa in November.
The US state department welcomed the end of the "vile occupation" of IS in Iraq and said the fight against the group would continue.
Iraq's announcement comes two days after the Russian military declared it had accomplished its mission of defeating IS in neighbouring Syria.
The jihadist group had seized large swathes of Syria and Iraq in 2014, when it proclaimed a "caliphate" and imposed its rule over some 10 million people.
But it suffered a series of defeats over the past two years, losing Iraq's second city of Mosul this July and its de facto capital of Raqqa in northern Syria last month.
Some IS fighters are reported to have dispersed into the Syrian countryside, while others are believed to have escaped across the Turkish border.
A battle unfinished
By Sebastian Usher, BBC Arab affairs editor
This is undeniably a proud moment for Mr Abadi - a victory that once looked like it might only ever be rhetorical rather than real.
But if the direct military war with IS in Iraq is genuinely over, and the country's elite forces can now step back after a conflict that's taken a huge toll on them, it doesn't mean the battle against the group's ideology or its ability to stage an insurgency is finished - whether in Iraq, Syria or the wider world.
Attacks may be at a lower level than they once were, but Iraqi towns and cities still fall prey to suicide bombers, while the conditions that fuelled the growth of jihadism remain - even in the territory that's been recaptured.
Mr Abadi said on Saturday: "Our forces are in complete control of the Iraqi-Syrian border and I therefore announce the end of the war against Daesh [IS].
"Our enemy wanted to kill our civilisation, but we have won through our unity and our determination. We have triumphed in little time."
The Iraqi armed forces issued a statement saying Iraq had been "totally liberated" from IS.
"The United States joins the government of Iraq in stressing that Iraq's liberation does not mean the fight against terrorism, and even against Isis [IS], in Iraq is over," she added.
UK Prime Minister Theresa May congratulated Mr Abadi on a "historic moment" but warned that IS still posed a threat, including from across the border in Syria.
Last month, the Syrian military said it had "fully liberated" the eastern border town of Albu Kamal, the last last urban stronghold of IS in that country.
On Thursday, the head of the Russian general staff's operations, Col-Gen Sergei Rudskoi, said: "The mission to defeat bandit units of the Islamic State terrorist organisation on the territory of Syria, carried out by the armed forces of the Russian Federation, has been accomplished."
He said Russia's military presence in Syria would now concentrate on preserving ceasefires and restoring peace.
The collapse of IS has raised fears that its foreign fighters will escape over Syria's borders to carry out more attacks abroad.
Iraq's war with IS
- January 2014: Forces of the Islamic State of Iraq and the Levant capture the cities of Falluja and Ramadi
- June 2014: The jihadists take Mosul, Iraq's second city, after a six-day battle
- 29 June 2014: ISIL changes its name to Islamic State, announcing a new caliphate under Abu Bakr al-Baghdadi
- August 2014: IS captures Sinjar. Some 200,000 civilians, mostly Yazidis, flee to the Sinjar mountains, prompting US-aided air drops
- March 2015: Iraqi forces and allied Shia militias retake Tikrit
- December 2015: Ramadi recaptured
- June 2016: Falluja retaken
- October 2016: Iraqi forces, Shia militias, Kurdish units and international allies lay siege to Mosul
- July 2017: Mosul retaken
- December 2017: Iraq's PM announces an end to the war with IS