CAIRO — Iranian protesters shouting “Death to England” stormed the British Embassy compound and a diplomatic residence in Tehran on Tuesday, tearing down the British flag, smashing windows, defacing walls and briefly detaining six staff members in what appeared to be a state-sponsored protest against Britain’s tough new economic sanctions against Iran.

The attack was the most serious diplomatic breach since the traumatic assault on the United States Embassy after Iran’s Islamic Revolution in 1979. Britain’s foreign secretary, William Hague, expressed outrage over the attack, saying Britain held Iran’s government responsible and promising “other, further, and serious consequences.”

The scale of the attack — led by hundreds of students described as members of the Basij militia by the Iranian state media — appeared to surprise even some Iranian officials. Later in the day, Iran’s Foreign Ministry released an uncharacteristic expression of regret that contrasted sharply with the angry rhetorical jabs at Britain issued a day earlier by Iran’s supreme leader, Ayatollah Ali Khamenei.

Image Dozens of Iranian protesters stormed the British embassy compound in Tehran on Tuesday, according to officials in London. Credit... The New York Times

Iran’s leaders, buffeted by the new sanctions, a collapsing economy and increasingly bitter infighting among the political elite, may have welcomed a chance to change the subject, analysts said. But the episode also appeared to be a shot across the bow aimed at the West, in line with Tehran’s old policies of escalating defiance.