An official from the Iraqi interior ministry said half a dozen tanks had broken down the walls of the jail and troops had then stormed it to free the two British soldiers. The governor of Basra last night condemned the "barbaric aggression" of British forces in storming the jail.

Aquil Jabbar, an Iraqi television cameraman who lives across the street from the jail, said dozens of Iraqi prisoners also fled in the confusion.

In a statement last night the defence secretary, John Reid, said: "I am pleased to be able to say that the British servicemen who were seen being injured in the graphic photographs are being treated for minor injuries only and are expected to return to duty shortly. We remain committed to helping the Iraqi government for as long as they judge that a coalition presence is necessary to provide security."

A Ministry of Defence spokesman said: "We have not had confirmation of the full details of this. We've heard nothing to suggest we stormed the prison. We understand there were negotiations."

In a day of dramatic incidents in the heart of the British-controlled area of Iraq, the two undercover soldiers - almost certainly special forces - were held by Iraqi security forces after clashes that reportedly left two people dead and threatened to escalate into a diplomatic incident between London and Baghdad.

The soldiers, who were said to have been wearing Arab headdress, were accused of firing at Iraqi police when stopped at a road block.

In another incident an angry crowd attacked a Warrior armoured personnel carrier with petrol bombs. A British soldier was forced to flee from his burning vehicle.

Muhammad al-Abadi, an official in the Basra governorate, told journalists the two undercover soldiers had looked suspicious to police. "A policeman approached them and then one of these guys fired at him. Then the police managed to capture them."

Senior British officials said the Iraqis who attacked the Warrior armoured vehicle had prepared their petrol bomb attack before the incident involving the two undercover soldiers. The origins of the attack on the Warrior, they say, lay in events the previous day when about 200 members of the al-Mahdi Army, a militia headed by the radical Shia cleric Moqtada al-Sadr, made a show of force in Basra, blocking roads in the city and demanding the release of their local commanders.