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 announcement comes two days after the Russian military announced the defeat of the militants in neighbouring Syria, where Moscow is backing Syrian government forces.

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.

Prime Minister Theresa May has congratulated Mr al-Abadi but warned the extremist group are 'not yet defeated'.

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

Several squadrons of Iraqi helicopters flew over Baghdad carrying Iraqi flags at noon, in an apparent rehearsal for a victory parade that Iraq is planning to hold in the coming days.

'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.'

Daesh is an Arabic acronym for Islamic State.

Iraq's fightback was launched with the backing of an air campaign waged by a US-led coalition, recapturing town after town from the clutches of the jihadists

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

The U.S.-led coalition that has been supporting the Iraqi forces against Islamic State welcomed the news in a tweet.

'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.

Defence Secretary Gavin Williamson praised Iraqi achievements but said Islamic State remained a threat.

'The fight though isn't over, as the group continue to pose a threat from across the Syrian border.

'They can plan and inspire terrorist attacks, which rally their branches worldwide and continue to inspire others at home and abroad to do us harm.

'We must continue to support the government of Iraq to ensure their long term security, the lives of the Iraqi and Syrian people, regional stability, and ultimately the security of our own country.'

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

The war has had a devastating impact on the areas previously controlled by the militants. About 3.2 million people remain displaced, a U.N. statement said on Saturday.

Suspected Islamic State members sit inside a small room in a prison south of Mosul

Islamic State leader Abu Bakr al-Baghdadi, who in 2014 declared in Mosul the founding of a new Islamic caliphate in Iraq and Syria, 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.

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

His followers imposed a reign of terror on the populations they controlled, alienating even many of those Sunni Muslims who had supported the group as allies against the heavy-handed rule of the Shi'ite majority-led government of the time.

The militants took thousands of women from the Yazidi minority, which lives in a mountain west of Mosul, as sex slaves and killed the men.

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 regional states and global powers.

In Iraq, the group confronted mainly U.S.-backed Iraqi government forces and Kurdish Peshmerga fighters, and Iranian-trained Shi'ite paramilitaries known as Popular Mobilisation.

In his speech to the Arab media conference, Abadi said 'the victories were achieved thanks to our unity', a reference to the contribution of different communities, including Sunni tribal fighters.

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

However, Iraq faces a fresh internal conflict after it retaliated economically and militarily against the semi-autonomous Kurdistan Regional Government (KRG) for holding a referendum on Kurdish independence despite Baghdad's opposition.

UK Prime Minister Theresa May, who said she saw the situation on the ground first hand during a visit to Iraq last week, added: 'Daesh no longer hold significant territory in Iraq or Syria. I pay tribute to the Iraqi security forces for their courage and sacrifice.

'I am proud that the UK, as a leading member of the global coalition, has stood shoulder-to-shoulder with Iraq.

'The UK, as a coalition member, has played a leading role in supporting the Iraqi security forces, including the armed forces and the Peshmerga, in the fight against Daesh. UK aircraft have launched over 1,350 air strikes in Iraq and have trained over 60,000 members of the Iraqi security forces.

'UK aid provides a vital lifeline to millions of Iraqis with emergency food, shelter, medical care and clean water. We are now supporting the government of Iraq to lay the foundations for an economy that meets the aspirations of all Iraqis.

'During my visit, I announced that the UK will invest £30 million in stabilisation support, £20 million in humanitarian assistance and £10 million to support counter-terrorist capacity building in Iraq.'

Iraq faces a fresh internal conflict after it retaliated economically and militarily against the semi-autonomous Kurdistan Regional Government (KRG) for holding a referendum on Kurdish independence despite Baghdad's opposition. Pictured: Militiamen watch Prime Minister al-Abadi's speech

The United States is also congratulating Iraq following the that the war is over.

State Department spokeswoman Heather Nauert says 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,' in an official statement released Saturday.

The statement adds '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, in Iraq is over.'

ISIS is an alternative acronym for IS.

Iraqi and coalition officials have stressed that despite the declaration of military victories against the extremists, Iraq continues to be faced with significant security threats.

The Islamic State group has repeatedly returned to their insurgent roots following territorial defeats, targeting Iraqi civilians and infrastructure far from frontline fighting.