Theresa May has hailed an "historic moment" for Iraq as the country insisted it had driven out Islamic State.
The Prime Minister cautioned, however, that while the extremist group also known as Daesh no longer held significant territory in Iraq or Syria, it had not yet been fully defeated.
The comments came after the PM's Iraqi counterpart Haider al-Abadi said Iraq had been liberated.
Mrs May said: "I congratulate prime minister Abadi and all Iraqis on this historic moment. I pay tribute to the Iraqi security forces for their courage and sacrifice.
"Daesh no longer hold significant territory in Iraq or Syria. This signals a new chapter towards a more peaceful, prosperous country.
"I am proud that the UK, as a leading member of the global coalition, has stood shoulder-to-shoulder with Iraq to help them open that chapter. I saw the effects of this first hand when I visited last week.
"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.
"We must be clear however, that whilst Daesh is failing, they are not yet defeated. They still pose a threat to Iraq, including from over the Syrian border.
"This is why, 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."
Mr al-Abadi formally announced victory over Islamic State in a TV address.
He said: "Honourable Iraqis, your land has been completely liberated. 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."