Britain condemned Iran for allowing protesters to storm its embassy and a separate diplomatic compound in Tehran on Tuesday, warning there will be “serious consequences” as a result.

The incursion happened after about 1,000 people gathered near the embassy to demand that the British ambassador be sent home immediately. The rally began quietly, but some participants then stormed the building, breaking down the door, throwing around papers and replacing the British flag with an Iranian one.

British Prime Minister David Cameron described the incursion as “outrageous and indefensible” and demanded that Iran immediately ensure the safety of all British Embassy personnel. Iranian security forces are responsible for guarding the embassy under international law, he said. By Tuesday evening, the protesters had been cleared from both sites by police and 12 students have been arrested.

Iran’s Foreign Ministry expressed its regret for the student protest, “which turned into an out of control demonstration,” in a statement on its website. The ministry said it would “take action through legal channels” against those who stormed the embassy building. It is now advising British nationals in Iran “to stay indoors, keep a low profile and await further advice.”

The demonstration followed a vote Sunday by the Iranian Parliament to expel the ambassador and reduce diplomatic relations with the United Kingdom in retaliation for newly imposed Western sanctions, according to Iran’s official Islamic Republic News Agency, or IRNA.

Britain cut all financial ties with Iran last week over concerns about Iran’s nuclear program, the first time it has cut an entire country’s banking sector off from British finance, the British Treasury announced. Iran insists its nuclear program is peaceful and has called the U.N. watchdog’s report “unbalanced” and “politically motivated.”