Labour's leadership has seen off calls for an early pull-out of troops from Iraq, winning a conference vote on the issue by a margin of four to one.
Jack Straw and Tony Blair won vote
The victory was widely expected after a deal was struck with unions to back an alternative motion saying troops should stay as long as Iraq wants.
Foreign Secretary Jack Straw insisted UK troops were not "occupying" Iraq.
The call for Mr Blair to set an early date for withdrawing the troops was defeated by 86% to 14%.
The victory for the leadership came on the last day of the conference which closed, after John Prescott's traditional upbeat send-off for party workers, with Tony Blair joining a chorus of steelworkers singing the Red Flag and Jerusalem.
The debate and votes on the last day of the conference came as reports suggested two Indonesian women, six Iraqis and two Lebanese who work for an electronics firm have been taken hostage.
A series of bombings across Baghdad also left more than 41 dead, most of them children, with more than 100 people injured.
In Brighton, Mr Straw warned a quick withdrawal of British troops would be disastrous for progress in rebuilding Iraq.
He told the conference: "The situation in Iraq is serious. But let us be clear about this: the agenda which the Iraqi people and government are seeking to follow is one set by them and endorsed by the whole international community."
He said that when an elected Iraqi government asked the coalition to leave, US-led forces would comply.
He warned that "today's scourge" was international terrorism, adding he was on his way to hold talks with British hostage Ken Bigley's family.
Defence Secretary Geoff Hoon also urged delegates not to back the "troops out" call, saying: "Whatever your views, we must now work to defeat terrorism.
"Now is the time to unite to help the Iraqi people rebuild their country, their economy, their way of life."
Meanwhile away from the conference centre Tory leader Michael Howard went on the offensive and for the first time accused Mr Blair of lying over the build-up to war.
'Loss of trust'
Mr Howard told the New Statesman: "I think people hold the view pretty firmly now that they were lied to over Iraq.
"I don't think that's the only thing they were lied to about... but Iraq is the great catalyst for the loss of trust in the government."
The prime minister later responded to the Tory leader's remarks saying: "I just find it contemptible because he
supported the war."
A frantic round of meetings between union bosses and senior ministers, including Mr Straw, on Wednesday evening is thought to have removed the prospect of government defeat.
The big unions backed a statement agreed at a meeting of Labour's ruling National Executive Committee (NEC) on Wednesday night, which agreed British troops should only stay in Iraq as long as Iraq's government wanted them there.
Mr Soames told the BBC's Daily Politics that the deal with unions over the troops pull-out vote reminded him of Labour in 1979 "stitching up a deal in smoke-filled rooms with union barons".
Sir Jeremy Greenstock, Britain's former special representative in Iraq, warned, on BBC Radio 4's Today, that setting an "arbitrary deadline" for withdrawal "would be giving in to terrorism".
Liberal Democrat defence spokesman Paul Keetch said: "I'm not sure that anybody's going to be that interested or trust what they are hearing from the Labour Party today.
"The fact is that Tony Blair took us into Iraq without the support of the majority of the people of this country and the situation is getting worse not better.
"We have had two more [UK] troops dead this week and the real question is when are those troops going to come home."
Gerard Batten, UK Independence Party euro MP, said: "We find we are in a situation where we are in a war that we shouldn't be in and he wants to say sorry.
"I think he's a fantasist who lives in a world where if he wants something to be true and he believes it, then for him it is and the rest of us are expected to go along with it.
"You cannot conduct a country's foreign and defence policy on this basis."