UK Prime Minister David Cameron has warned Iran of "serious consequences" after protesters stormed the British embassy and a UK compound in Tehran.
Offices were ransacked and flags burned in the attacks, which followed a demonstration against sanctions imposed on Iran over its nuclear programme.
Mr Cameron described the attacks as "outrageous and indefensible".
The US and EU also condemned the attacks. Iran's foreign ministry expressed "regret" for the incidents.
The demonstrations followed a vote in Iran's parliament to reduce diplomatic ties with Britain in retaliation for imposing further sanctions.
Mr Cameron said the failure of the Iranian government to defend British staff and property was "a disgrace".
He said all British staff and their dependents had been accounted for and he praised Britain's ambassador to Iran, Dominick Chilcott, for handling a "dangerous situation with calm and professionalism".
"The Iranian government must recognise that there will be serious consequences for failing to protect our staff. We will consider what these measures should be in the coming days," he added.
US President Barack Obama said he was "deeply disturbed" by the attack.
"That kind of behaviour is not acceptable, and I strongly urge the Iranian government to hold those who are responsible to task," he said.
The US Secretary of State, Hillary Clinton, called on Iran to protect foreign embassies in Tehran.
"The United States condemns this attack in the strongest possible terms. It is an affront not only to the British people but also the international community," Mrs Clinton said at a news conference in South Korea, where she was attending a global development conference.
Germany, France and the EU also condemned the attack.
Hundreds of protesters - whom Iran described as "students" - had massed outside the embassy compound before scaling the walls and the gates.
A car was set alight, windows were broken, offices wrecked and paintings and other items dragged outside and dumped.
The students chanted "the embassy of Britain should be taken over" and "death to England".
Another UK diplomatic compound in northern Tehran, known locally as Qolhak Garden, was also overrun and damaged.
The occupations went on for several hours. By nightfall riot police had restored order and evicted the protesters.
The Iranian Foreign Ministry expressed "regret for certain unacceptable behaviour by a small number of protesters in spite of efforts by the police".
"The relevant authorities have been asked to take the necessary measures and look into this issue immediately," it said.
Correspondents say the protests were organised by pro-government groups at universities and Islamic seminaries. The demonstrations also marked the anniversary of the assassination of an Iranian nuclear scientist in Tehran, which many Iranians have blamed on the UK. Britain denies any involvement.
Last week the US, UK and Canada announced new measures targeting Iran over its controversial nuclear plans.
That followed a report from the International Atomic Energy Agency (IAEA) that suggested Iran was working towards acquiring a nuclear weapon.
It said Iran had carried out tests "relevant to the development of a nuclear device".
For its part, the UK Treasury imposed sanctions on Iranian banks, accusing them of facilitating the country's nuclear programme.
On Sunday, Iran's parliament voted by a large majority to downgrade diplomatic relations with the UK in response to the British action.
Iranian radio reported that some MPs had chanted "Death to Britain" during the vote, which was approved by 87% of MPs.
Iran insists its nuclear programme is for peaceful purposes only.