The Iraqi military has "fully liberated" all of Iraq's territory of "ISIS terrorist gangs" and retaken full control of the Iraqi-Syrian border, it said Saturday in a statement.
"Our heroic armed forces have now secured the entire length of the Iraq-Syria border," Prime Minister Haider Al-Abadi said on his Twitter account. "We defeated Daesh (ISIS) through our unity and sacrifice for the nation. Long live Iraq and its people."
New: US will keep "advising, training, and equipping" Iraqi Security Forces, official says
3.2 million people have been displaced in the fight against ISIS, the United Nations reports
ISIS, an acronym for Islamic State in Iraq and Syria, rapidly captured large territories in Iraq and Syria and declared a caliphate in 2014. The group controlled more than 34,000 square miles of territory from the Mediterranean coast to south of Baghdad.
The campaign to eradicate the Islamic State took more than three years and about 25,000 coalition airstrikes. Iraqi forces have increasingly been pushing ISIS out of the country over the past few months. Troops last month retook the town of Rawa, one of ISIS's last footholds in the country. At that point, only pockets of ISIS resistance remained.
Al-Abadi later in a televised speech lauded the victory.
"Dear Iraqis, your land has been completely liberated, and your towns and villages have been returned to the homeland," he said. "The dream of liberation became a reality."
"ISIS dream has come to an end," he added. "We must remove all its effects and should not allow terrorism to return again."
ISIS remains a threat
ISIS' rise and the world's military response has created a devastating crisis for civilians and led to the displacement of more than 3.2 million people, according to the United Nations.
"Our people have paid a high price for its security and stability and the blood of its finest youth, men and women," Al-Abadi said. "Millions of families have suffered the hardships of displacement."
The underlying conditions that allowed for the rise of ISIS, such as sectarian and ethnic divisions and a lack of economic opportunities, remain potent issues in the region. ISIS began as an insurgency group and could return to its roots, and jihadi groups like al Qaeda could grow.
In addition, although ISIS no longer controls territory in Iraq, the threat of violence from members of the group is not over. As it has lost territory over the past year or so, ISIS has morphed into more of an ideological threat, both in the region and in the West.
"Despite the announcement of the final victory, we must remain vigilant and ready to face any terrorist attempt targeting our people and our country," Al-Abadi said. "Terrorism is a permanent enemy and the battle with it continues, and we must preserve this unity, which with it we have defeated ISIS."
The humanitarian aid group Mercy Corps said it was moving into areas retaken from ISIS to provide support and evaluate long-term needs.
"As humanitarians, we are looking at a different kind of fight, a good fight," said Deepmala Mahla, Mercy Corps' country director for Iraq. "The battle for a better future for Iraqis is happening now."
US salutes 'historic gains'
The US special presidential envoy for the Global Coalition to Defeat ISIS tweeted his support for Abadi's declaration and said the coalition would remain to assist the Iraqis.
"We congratulate the Prime Minister and all the Iraqi people on this significant achievement, which many thought impossible," Brett McGurk wrote.
"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," McGurk added. "That spirit must be renewed and continue as Iraq works to consolidate these historic gains over the coming year.
"Our @coalition will continue to stand with #Iraq to support its security forces, economy, and stabilization to help ensure that #ISIS can never again threaten Iraq's people or use its territory as a haven," he wrote. "We mark today's historic victory mindful of the work that remains."
The US State Department applauded the Iraqi announcement but said its work is not over, spokeswoman Heather Nauert said.
"The United States, along with the Global Coalition to Defeat ISIS, will continue to partner with the Iraqi Security Forces, advising, training, and equipping them. Together, we must be vigilant in countering all extremist ideologies to prevent the return of ISIS or the emergence of threats by other terrorist groups," she said.
The US has contributed nearly $1.7 billion in humanitarian assistance and committed more than $265 million in stabilization assistance to Iraq since 2014, Nauert's statement said, adding that those investments and other work have helped get more than 2.7 million Iraqis back to their homes.
"Working 'by, with, and through' the Government of Iraq, we will continue to help our displaced Iraqi friends return to their communities and support them as they begin to reestablish their lives," she said. "We remain committed to standing with the Government of Iraq and the Iraqi people to stabilize areas liberated from ISIS control."