The captives were allegedly undercover commandos, who had been arrested on charges of shooting two Iraqi policemen.
Witnesses said about 150 Iraqi prisoners fled the jail as well.
Iraqi police detained the two British soldiers in the Basra jail following a shooting incident, a British military spokesman and police sources said.
Britain, however, denied reports late on Monday that its troops had stormed the prison to free two soldiers, saying the pair were released after negotiations.
“We’ve heard nothing to suggest we stormed the prison,” a Defence Ministry spokesman in London said. “We understand there were negotiations.”
The spokesman said he had no more details of the soldiers’ release.
British Defence Secretary John Reid said in a statement that
the two men, who have not been named, were back with British forces.
Iraqi protesters threw stones and
“I can confirm that the two British service personnel detained earlier today by the IPS (Iraq Police Service), have now been released and are back with British forces,” he said.
“The situation in Basra is currently calmer after a day of
disturbances. At this stage it is not possible to be certain why these disturbances began.”
Earlier in the day, British forces surrounded a in the centre of Basra after Iraqi police refused to release the two men.
The British forces were themselves surrounded by demonstrators who threw stones and the soldiers fired warning shots, he said.
Demonstrators then set fire to two British tanks, forcing soldiers to jump from the tanks. The soldiers withdrew without returning fire. It was not immediately known if there were any injuries.
One Basra policeman said the two men who were detained were undercover soldiers, wearing Arab costume, who allegedly fired at a police patrol before being forced to stop.
At a recent military briefing in Basra, a journalist was told British soldiers had been ordered not to stop at Iraqi police checkpoints for fear that fighters could be posing as Iraqi police.
In another incident on Sunday, angry Shia militiamen from the Jaish al-Mahdi (al-Mahdi Army) demonstrated in central Basra after British soldiers arrested their local leader on charges of terrorism.
British forces confirmed they had arrested “three prominent individuals”.
“The operation is the result of an ongoing multinational force investigation that identified individuals believed to be responsible for organising terrorist attacks against multinational forces,” a British military statement said.
Three British soldiers and six other members of the international force have been killed in attacks in the Basra area over the past two months.
It was not immediately known if there was any link between the incidents on Sunday and Monday.
Iraqi journalist killed
Iraqi journalist Fakher Haidar
Also in Basra, Iraqi journalist Fakher Haidar al-Tamimi, who worked for foreign media in the country, was found shot dead on Monday, after an overnight kidnapping, his wife said.
“Eight masked gunmen kidnapped him around 1am (2100 GMT Sunday) from his house in the al-Asmaey neighbourhood,” she said.
“They tied his hands saying they were police and that they would bring him back after interrogation.”
His body was found in al-Kiblah, a southwestern district of Basra, an area patrolled by British forces. “He was shot in the head,” his wife said.
Al-Tamimi had worked as a freelance journalist for a number of Western media organisations.