Prime Minister Haider al-Abadi on Saturday declared victory in a three-year war by Iraqi forces to expel the ISIL jihadist group that at its height endangered Iraq's very existence.
"Our forces are in complete control of the Iraqi-Syrian border and I therefore announce the end of the war against Daesh (ISIL)," Abadi told a conference in Baghdad.
"Our enemy wanted to kill our civilisation, but we have won through our unity and our determination. We have triumphed in little time," he said.
ISIL seized vast areas north and west of Baghdad in a lightning offensive in 2014.
With Iraq's army and police retreating in disarray at the time, Ayatollah Ali Sistani, spiritual leader of the country's majority Shiites, called for a general mobilisation, leading to the formation of Hashed al-Shaabi paramilitary units.
Iraq's fightback was also launched with the backing of an air campaign waged by a US-led coalition, recapturing town after town from the clutches of the jihadists in fierce urban warfare.
"I announce the good news: the liberation by Iraqi forces of the whole of the Iraqi-Syrian border," the prime minister told the conference organised by the Iraqi journalists' union.
Iraq's close ally Iran already declared victory over ISIL last month, as the jihadists clung to just a few remaining scraps of territory.
But Abadi said at the time that he would not follow suit until the desert on the border with Syria had been cleared.
The jihadists' defeat is a massive turnaround for an organisation that in 2014 ruled over seven million people in a territory as large as Italy encompassing large parts of Syria and nearly a third of Iraq.
On the Syrian side of the border, ISIL is under massive pressure too.
On Thursday, Russia's defence ministry said its mission in support of the Syrian regime to oust ISIL jihadists had been "accomplished" and the country was "completely liberated".
In the border region, pro-government forces and US-backed Kurdish-led forces are conducting operations to clear ISIL fighters from the countryside north of the Euphrates valley after ousting them from all Syrian towns.
The head of Iraq's Joint Operations Command set up to fight ISIL, General Abdel Amir Yarallah, gave an update on Saturday to announce that the desert valley of Al-Jazira was under the control of Iraqi troops and the Hashed all the way from Nineveh province in the north to Anbar in the west.
Federal forces "now control the border with Syria from Al-Walid border crossing to that of Rabia", covering a distance of 435 kilometres (270 miles), he said.
ISIL retains capacity
Despite the victory announcements, experts have warned that ISIL retains the capacity as an insurgency group to carry out high-casualty bomb attacks through sleeper cells.
It also retains natural hideouts in the deep gorges of Wadi Hauran, Iraq's longest valley stretching from the Saudi border up to the Euphrates River and the frontiers with Syria and Jordan.
The fightback in Iraq kicked off with the "liberation" of Tikrit, north of Baghdad, that had been under ISIL control for nearly 10 months.
The operations have involved both Tehran, through Iranian-trained Shiite militias in the Hashed al-Shaabi coalition, and Washington as head of the anti-jihadist coalition.
The western cities of Ramadi and Fallujah followed in 2016 before the turning point of the recapture of Iraq's second city of Mosul in July this year after a nine-month offensive led by a 30,000-strong federal force.
Abadi said the battle for Mosul that left the city in ruins and thousands of its residents displaced marked the end of the jihadists' "caliphate".
Victory was declared at the end of August in Tal Afar, the last major ISIL urban stronghold in northern Iraq, before a final military operation launched last month against ISIL in a vast desert region of western Iraq.
Subscribe to Arabian Business' newsletter to receive the latest breaking news and business stories in Dubai,the UAE and the GCC straight to your inbox.