British Prime Minister David Cameron on Tuesday labeled an attack by Iranian protesters on the British embassy in Tehran "outrageous and indefensible" and called on the Islamic republic to prosecute those responsible.

Echoing earlier comments from Foreign Secretary William Hague, Cameron also warned of "serious consequences" for Iran, adding that Britain would consider what measures it would take in the coming days.

"The attack on the British embassy in Tehran today was outrageous and indefensible. The failure of the Iranian government to defend British staff and property was a disgrace," Cameron said in a statement.

"The Iranian government must recognize that there will be serious consequences for failing to protect our staff. We will consider what these measures should be in the coming days."

Foreign Hague said earlier on Tuesday that the U.K. "holds the Iranian government responsible for its failure to take adequate measures to protect our embassy, as it is required to do. Clearly there will be other, further, and serious consequences."

Hague said all embassy staff and their dependants had been accounted for. Earlier reports said six British embassy staff were briefly held hostage during the incident.

Iranian protesters smashed windows, hurled petrol bombs and burned the British flag during a rally to protest against sanctions imposed by Britain, live Iranian television showed.

The attacks followed the rapid approval by Iran's Guardian Council of a parliamentary bill compelling the government to expel the British ambassador in retaliation for the sanctions, and warnings from a lawmaker that angry Iranians could storm the British embassy as they did to the U.S. mission in 1979.

Demonstrators waved flags symbolizing martyrdom and held up portraits of Iran's Supreme Leader Ayatollah Ali Khamenei.

A separate group of protesters broke into a second British embassy compound in the north of the city, the IRNA state news agency said, and seized "classified documents".

Riot police later moved in and mounted the embassy gates, helping protesters climb back on the street outside, television pictures showed, and began to slowly clear demonstrators.

The incident followed Britain's imposition of new sanctions on the Islamic state last week over its nuclear program.

London banned all British financial institutions from doing business with their Iranian counterparts, including the Central Bank of Iran, as part of a new wave of sanctions by Western countries.