Two British soldiers whose imprisonment prompted UK troops to storm a Basra police station were later rescued from militia, the Ministry of Defence says.
Brigadier John Lorimer said it was of "deep concern" the men detained by police ended up held by Shia militia.
Basra governor Mohammed al-Waili said the men - possibly working undercover - were arrested for allegedly shooting dead a policeman and wounding another.
The arrests sparked unrest in which Army vehicles were attacked.
In a statement, Brig Lorimer said that under Iraqi law the soldiers should have been handed over to coalition authorities, but this failed to happen despite repeated requests.
"I had good reason to believe that the lives of the soldiers were at risk and troops were sent to the area of Basra near the police station to help ensure their safety by providing a cordon," Brig Lorimer said.
"As shown on television these troops were attacked with firebombs and rockets by a violent and determined crowd.
"Later in the day, however, I became more concerned about the safety of the two soldiers after we received information that they had been handed over to militia elements."
After troops broke into the police station to confirm the men were not there, they staged a rescue from a house in Basra, said the commanding officer of 12 Mechanised Brigade in Basra.
Brig Lorimer added: "It is of deep concern that British soldiers held by the police should then end up being held by the militia. This is unacceptable."
BBC Defence Correspondent Paul Wood said local police revealed the whereabouts of the two men after the station was stormed.
"At the point of a 30mm cannon - no shots were fired - but at the point of this cannon, the Iraqi police gave away the location of where the two British soldiers had been taken," he said.
Vehicles set alight
A Ministry of Defence (MoD) spokesman earlier said a Warrior armoured vehicle had broken down the perimeter wall at the police station.
Mr al-Waili said more than 10 vehicles and helicopters had been used in an operation that was a "barbaric act of aggression".
The MoD denied witness reports to the Associated Press that about 150 prisoners escaped after the demolition of the wall.
Two British armoured vehicles earlier sent to the police station were set alight in clashes.
TV pictures showed crowds of angry protesters hurling petrol bombs and stones, and soldiers in combat gear clambering from one of the flaming vehicles and making their escape.
Reports said two Iraqi civilians were killed and three soldiers injured in the clashes.
In a statement, Defence Secretary John Reid said the soldiers were being treated for minor injuries.
The BBC's Paul Wood said none of Basra's 20,000 police officers had helped the UK troops "partly because of reticence by their commanders, partly because, I am afraid, they have been infiltrated by these militants".
He added: "Now we are in the situation where presumably revenge will be sought by relatives of the dead Iraqis - and our allies in the police, I think there has been a complete breakdown of trust and it's going to be very difficult for British troops to call on them."
Mr Reid said: "We remain committed to helping the Iraqi government for as long as they judge that a coalition presence is necessary to provide security."
But Liberal Democrat foreign affairs spokesman Sir Menzies Campbell said: "It is hard to see how relations between the British military and the civilian Iraqi authorities in Basra will ever be the same again.
British officials would not say if the two men were working undercover
"This is bound to be seen as a humiliation by many Iraqis - something the insurgents will use to their advantage."
Conservative shadow foreign secretary Michael Ancram called on ministers to explain who would decide when to leave Iraq and on what basis.
Colonel Tim Collins, a former commander of British troops in Iraq, said Monday's violence did not represent a breakdown of law and order in Basra, which was still a safer city than Baghdad.
On Tuesday a suicide car bombing in the northern city of Mosul killed a US diplomatic security guard and three US private contractors, according to American officials.
The US military also announced that four of its soldiers attached to the Marines were killed in two roadside bombings in the western city of Ramadi on Monday.