After more than three years of combat operations, Iraq announced Saturday that the fight against the Islamic State group is over after the country's security forces drove the extremists from all of the territory they once held. Iraqi and American officials warned, however, that key challenges remain despite the military victory.

Prime Minister Haider al-Abadi formally announced the victory in an address to the nation aired on Iraqi state television Saturday evening.

"Honourable Iraqis, your land has been completely liberated," he said. "The liberation dream has become a reality. We achieved victory in difficult circumstances and with God's help, the steadfastness of our people and the bravery of our heroic forces we prevailed."

"The flag of Iraq is flying high today over all Iraqi territory and at the farthest point on the border," he added, standing before the most senior members of Iraq's security forces.

Following al-Abadi's remarks, his office declared a public holiday Sunday in celebration of the victory, according to an official statement from the prime minister's office.

Iraqi forces mopped up the last pockets of ISIS fighters from Iraq's western deserts Saturday, securing the country's border with Syria, a step that marked the end of combat operations against the extremists.

"All Iraqi lands are liberated from terrorist Daesh gangs and our forces completely control the international Iraqi-Syrian border," said Lt. Gen. Abdul-Amir Rasheed Yar Allah, a senior Iraqi military commander, in a statement on Saturday afternoon.

Iraqi Prime Minister Haider al-Abadi declared the fight against ISIS concluded in July, but clashes continued in the city for weeks afterward. (Alex Brandon/Associated Press)

The U.S. applauded the prime minister's announcement.

The U.S. offers "sincere congratulations to the Iraqi people and to the brave Iraqi Security Forces, many of whom lost their lives heroically fighting ISIS," State Department spokesperson Heather Nauert said in a written statement.

"Our coalition will continue to stand with Iraq to support its security forces, economy and stabilization to help ensure that ISIS can never against threaten Iraq's people or use its territory as a haven," said Brett McGurk, U.S. special presidential envoy to the anti-ISIS coalition, in a statement posted to his official Twitter account.

"We mark today's historic victory mindful of the work that remains," he added.

Iraq's government remains faced with significant security threats, an economic crisis and the enormous task of rebuilding swaths of territory decimated by the ISIS fight.

Anti-ISIS coalition

ISIS fighters overran nearly a third of Iraqi territory, including Mosul, the country's second largest city and Tikrit, the capital of Iraq's central Salahuddin province in the summer of 2014. The following year, ISIS fighters also overran Anbar's provincial capital of Ramadi.

Over the past 3½ half years, Iraqi ground forces closely backed by the U.S.-led coalition and mostly Shia paramilitary forces backed by Iran have slowly retaken all of that territory.

Iraqi forces show victory signs after they captured Rawa, the last remaining town under Islamic State control, in Iraq on Nov. 17. (Reuters)

The pace of the anti-ISIS operation accelerated last year as coalition-backed Iraqi ground forces prepared for the assault on Mosul that was formally launched in October 2016.

After more than nine months of mostly grueling urban combat, Al-Abadi declared victory over ISIS in Mosul in July.

In the months that followed Iraqi forces retook a handful of other ISIS held towns including Tal Afar in August, Hawija in September and Qaim in October. In November, Iraqi forces retook the last Iraqi town held by ISIS — Rawah, near the border with Syria.

However, ISIS fighters remain capable of carrying out insurgent attacks in Iraq, and the group has recovered from past setbacks.

Rebuilding a 'big challenge'

ISIS insurgent networks continue to pose a threat to Baghdad and other Iraqi cities, a senior Iraqi security official said, speaking on condition of anonymity in line with regulations. The official said intelligence gathering would become increasingly important in the post-military phase of the fight against ISIS.

"The triumph of military operations alone is not enough without stability," government spokesperson Saad al-Hadithi said, explaining that rebuilding in the wake of military victories against ISIS remained a "big challenge" for the Iraqi government.

Additionally, some three million Iraqis remain displaced by the fight against ISIS, according to the United Nations.

Al-Abadi also remains faced with a political and military stand-off with the country's Kurdish region over a referendum held on independence.

Oil wells on the edge of Qaraya burn days after the town was retaken from the Islamic State group by Iraqi ground forces backed by U.S.-led coalition air power, on Aug. 28, 2016.

Federal government troops remain deployed throughout a string of disputed territories claimed by both Baghdad and Iraq's Kurds — who were also backed by U.S.-led coalition forces in the fight against ISIS. While Baghdad and Irbil have both stated a willingness to talk, negotiations to end the dispute have not yet begun.

As he closed his national address, al-Abadi acknowledged the challenges that remain for Iraq.

"I urge everyone to refrain from returning to the inflammatory and sectarian discourse that empowered gangs to occupy our cities and villages," he said.

"Our people have paid a dear price," he added. "We must turn this page forever."​