British troops have withdrawn from central Basra to an airbase outside the southern Iraqi city.
Some 550 soldiers left Basra Palace to join 5,000 troops at the UK's Basra Airport base outside the city in an operation lasting more than 12 hours.
Prime Minister Gordon Brown insisted the withdrawal of British troops from the city was not a defeat.
Iraqi troops will take the place of British forces, which will have an "overwatch" role.
This will mean troops cannot go out unless requested by Iraqi authorities, but they will still train and mentor Iraqi security forces.
The PM told BBC Radio 4's Today programme the number of British troops in Iraq would remain roughly the same, and that they could "re-intervene" if necessary.
He promised they would continue to "discharge our duties to the Iraqi people and the international community".
The Ministry of Defence said UK forces would "retain security responsibility" for Basra until the full handover, and continue to train Iraqi troops.
The handover of Basra province is now due in the autumn.
British spokesman in Basra Major Mike Shearer said a bugler sounded the advance before the troops started to "extract" from the palace.
"There were no major incidents during the operation and all troops were back at the continuing operating base by midday today Iraqi time," he said.
Tom Newton-Dunn, defence editor with the Sun, the only British journalist to witness the pull-out, said the operation was an extraordinary sight:
"120 different armoured vehicles moved out of the palace in a column that ended up being some 8km long," he said.
"They left about midnight. It took them until about 11 o'clock this morning our time to get in the base, every single last man."
The head of Iraqi security forces in Basra province, Gen Mohan Tahir, said Iraqi troops were now in control of Basra Palace.
Watib Al-Amood of Basra's city council said the move from the palace to the airport was largely symbolic.
He said: "It is just five minutes' drive. If there is anything, any threat, inside the city it is just five minutes' drive from there to the city."
BBC News world affairs editor John Simpson said it was hard not to use the word "defeat" in connection with the withdrawal.
He said: "The fact is it isn't a defeat today, it was a defeat some years ago.
"It was a defeat when the British were too undermanned, too poorly resourced to be able to deal with these militias which have been fighting down there pretty much ever since.
"We have to say it could have been really much worse. There were people in the White House who said the British would be chased out by the Iraqis, firing and shooting at them as they went."
A poll for BBC Two's Newsnight programme suggests more than two-thirds of the British public think UK troops are losing the war in Iraq.
Some 52% of those questioned believed victory was impossible, and a further 17% thought British troops were losing but could eventually win.
Anti-war campaigner Reg Keys, whose son Tom died in Iraq in 2003, said: "I'm relieved and I dare say a lot of the families of those troops serving out there will be relieved that they're pulling back to a safer zone.
"And let's make this absolutely abundantly clear: It isn't a withdrawal, it's a strategic retreat, and they can no longer hold back the tide of insurgency in Iraq down round the Basra area."
BBC correspondent Richard Galpin in Baghdad said it was a "highly symbolic moment, marking the end of the Britain's physical military presence in any Iraqi city".
Over the past year British forces have handed over control of three southern Iraqi provinces, with only Basra province remaining under their control.
The security situation in the city will be watched closely, as there are concerns rival Shia factions could vie for control.
Are you an Iraqi in Basra? How safe do you feel? Have you served with the armed forces there? Send us your experiences by filling out the form below.
The BBC may edit your comments and not all emails will be published. Your comments may be published on any BBC media worldwide.