Iranian protesters stormed two British diplomatic compounds in Tehran on Tuesday, smashing windows, hurling petrol bombs and burning the British flag in protest against sanctions imposed by London.
Britain said it was outraged by the attacks and warned of serious consequences.
The attacks come at a time of rising diplomatic tension between Iran and Western nations who last week imposed fresh sanctions over Tehran's nuclear programme which they believe is aimed at achieving the capability of making an atomic bomb.
Iran, the world's fifth biggest oil exporter, says it only wants nuclear plants to generate electricity.
The embassy storming is also a clear sign of deepening political infighting within Iran's ruling hardline elites, with the conservative-led parliament attempting to force the hand of President Mahmoud Ahmadinejad and expel the British ambassador.
Radicals in Iran and in the West are always in favour of crisis ... Such radical hardliners in Iran will use the crisis to unite people and also to blame the crisis for the fading economy, said political analyst Hasan Sedghi.
Several dozen protesters broke away from a crowd of a few hundred outside the main British embassy compound in downtown Tehran, scaled the gates, broke the locks and went inside.
Protesters pulled down the British flag, burnt it, and put up the Iranian flag, Iranian news agencies and news pictures showed. Inside, the demonstrators smashed windows of office and residential quarters and set a car ablaze, news pictures showed.
One took a framed picture of the Queen, state TV showed. Others carried the royal crest out through the embassy gate as police stood by, pictures carried by the Fars news agency showed.
Demonstrators waved flags symbolising martyrdom and held portraits of Supreme Leader Ayatollah Ali Khamenei who has the final say on matters of state in Iran.
Another group of protesters broke into a second British compound at Qolhak in north Tehran, the IRNA state news agency said. Once the embassy's summer quarters, the sprawling, tree-lined compound is now used to house diplomatic staff.
An Iranian report said six British embassy staff had been briefly held by the protesters. Foreign Secretary William Hague said the situation had been confusing and that he would not have called them hostages.
Police freed the six people working for the British embassy in Qolhak garden, Iran's Fars news agency said.
A German school next to the Qolhak compound was also damaged, the German government said.
Police appeared to have cleared the demonstrators in front of the main downtown embassy compound, but later clashed with hardline protesters and fired tear gas to attempt to disperse them, Fars said. Protesters nevertheless entered the compound a second time, before once again leaving, it said.
Prime Minister David Cameron chaired a meeting of the government crisis committee to discuss the attacks, Hague said.
We hold the Iranian government responsible for its failure to take adequate measures to protect our embassy, as it is required to do, Hague said in a statement. Clearly there will be other, further, and serious consequences.
The United States condemned in the strongest terms the storming of the embassy and urged Iran to prosecute offenders. The European Union and many of its member states also condemned the attacks.
There have been regular protests outside the British embassy over the years since the 1979 Islamic revolution that toppled the U.S.-backed shah, but never have any been so violent.
The attacks and hostage-taking were reminiscent of the 1979 takeover of the U.S. embassy in Tehran carried out by radical students who held 52 Americans hostage for 444 days. The United States and Iran have cut diplomatic ties ever since.
The demonstrations appeared to be a bid by conservatives who control parliament to press home their demand, passed in parliament last week and quickly endorsed by the Guardian Council on Tuesday, for the government to expel the British ambassador in retaliation for the sanctions.
A lawmaker had warned on Sunday that angry Iranians could storm the British embassy.
Parliament officially notified the president over a bill regarding degrading the ties with Britain, obliging the government to implement it within five days, Fars news agency quoted speaker Ali Larijani as saying.
Ahmadinejad's government has shown no willingness to compromise on its refusal to halt its nuclear work, but has sought to keep channels of negotiation open in an effort to limit the worst effects of sanctions.
An Iranian official told Reuters the storming of the British compounds was not planned by the government.
It was not an organised measure. The establishment had no role in it. It was not planned, said the official, who declined to be identified. Iran's Foreign Ministry said it regretted the attacks and was committed to ensuring the safety of diplomats.
Police made a number of arrests, Fars said, quoting a police chief as saying they would be handed over to the judiciary.
Protesters said they planned to stage a sit-in at the gates of the north Tehran compound and would not move until they were told to do so by Iran's religious leaders.
Britain, along with the United States and Canada imposed new unilateral sanctions on Iran last week, while the EU, France and Italy have all said financial measures against Tehran should be strengthened.
London banned all British financial institutions from doing business with their Iranian counterparts, including the Central Bank of Iran.
(Additional reporting by Hossein Jaseb and Hashem Kalantari in Tehran, Parisa Hafezi in Istanbul, and William Maclean and Adrian Croft in London; Writing by Jon Hemming; Editing by Andrew Roche)