Tony Blair, on a surprise visit to Basra in southern Iraq, has told British troops they fought for a "noble and good cause".
The prime minister said Iraq had been a "test case" in the fight against brutal and repressive regimes.
He thanked the troops - "the new pioneers of soldiering" - for their part in winning the conflict but told them they now had to "win the peace".
It is Mr Blair's second visit to the country since the end of the Iraq war.
He visited 600 representatives of the 10,000 British servicemen and women still stationed in the south of the country. Fifty-four British soldiers have died in Iraq since March last year.
Later on his trip Mr Blair met US civilian administrator Paul Bremer and his deputy, Sir
Jeremy Greenstock, Britain's top diplomat in Iraq.
Speaking to the troops, Mr Blair reiterated his personal belief in the necessity of the war.
"You know how passionately I believed in the wisdom of the cause to establish stability."
Mr Blair said no democratic regime would spend billions of pounds on chemical and biological weapons when its own people were suffering.
He said British armed forces were "the new pioneers of soldiering
in the 21st century", defending the world against the dual threats of terrorism and brutal and repressive regimes.
The prime minister - who flew in on a military jet from the Egyptian resort of Sharm-el-Sheik, where he spent the Christmas break with his family - also spoke of the "virus of Islamic terrorism".
He warned that brutal and repressive regimes were developing weapons of mass destruction that were "a huge liability for the whole security of the world."
In the case of Iraq, he said: "If we had backed away... we would never have been able to confront this threat in the other countries where it exists."
Thanking troops for their contribution, he added: "Iraq is now taking shape with your help and guidance in a way that would have been unthinkable a year ago."
Mr Blair's first stop had been at a newly-opened police academy where British police officers are training local Iraqi police officers in so-called "democratic policing" including teaching them interrogation techniques.
He was shown a demonstration of unarmed defence training and a mock vehicle search.
Speaking ahead of the lunch meeting between Mr Blair and Paul Bremer, the UK's top diplomat in Iraq said their discussions would focus on the "immediate political steps to be taken" and not the search for evidence of weapons of mass destruction.
"If they were spending a day together, they
might talk about it - but not within one hour," Sir
Jeremy Greenstock said.
More 'big bang' attacks predicted
"We're in the middle of quite an interesting political
negotiation over how the transitional assembly and government are
going to be chosen."
At the same time Sir Jeremy warned how former regime loyalists would continue to launch "big bang" attacks against the coalition.
They were using bigger bombs and more sophisticated remote control devices, with al-Qaeda trying to become involved too.
"It is very
dangerous out there," Sir Jeremy added.