Iraq Prime Minister Haider al-Abadi gestures during a press conference in Baghdad. Picture: Karim Kadim/AP

Baghdad - Prime Minister Haider al-Abadi said on Saturday that Iraqi forces had driven the last remnants of Islamic State from the country, three years after the militant group captured about a third of Iraq's territory.

The Iraqi forces recaptured the last areas still under IS control along the border with Syria, state television quoted Abadi as telling an Arab media conference in Baghdad.

"Commander-in-Chief @HaiderAlAbadi announces that Iraq's armed forces have secured the western desert & the entire Iraq Syria border, says this marks the end of the war against Daesh terrorists who have been completely defeated and evicted from Iraq," the federal government's official account tweeted.

In a separate tweet later, Abadi said: "Our heroic armed forces have now secured the entire length of the Iraq-Syria border. We defeated Daesh through our unity and sacrifice for the nation. Long live Iraq and its people."

The U.S.-led coalition that has been supporting Iraqi force against Islamic State tweeted its congratulations.

"The Coalition congratulate the people of Iraq on their significant victory against #Daesh. We stand by them as they set the conditions for a secure and prosperous #futureiraq," said the tweet. Daesh is the Arabic name for Islamic State.

Last month Iraqi forces captured Rawa, the last remaining town under Islamic State control, near the Syrian border.

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 both countries now expect a new phase of guerrilla warfare, a tactic the militants have already shown themselves capable of.

Islamic State leader Abu Bakr al-Baghdadi, who in 2014 had declared in Mosul the founding of a new Islamic caliphate, released an audio recording on Sept. 28 that indicated he was alive, after several reports he had been killed. He urged his followers to keep up the fight despite setbacks.

He is believed to be hiding in the stretch of desert in the border area.

Driven from its two de facto capitals, 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 most regional states and global powers.

In Iraq, the group confronted U.S.-backed Iraqi government forces and Iranian-trained paramilitary groups known as Popular Mobilisation.