Young Iranians stormed the British Embassy compound and a separate diplomatic residence here on Tuesday as security forces looked on, triggering a dramatic escalation in tensions between Iran and the West at a time of already high anxiety over Iran’s nuclear ambitions.

The apparently deliberate decision by Iranian authorities to allow demonstrators and paramilitary members to pillage the two sites is likely to increase Tehran’s global isolation. It also could increase the strain in Iran between two rival blocs: forces loyal to the supreme leader, Ayatollah Ali Khamenei, and those aligned with President Mahmoud Ahmadinejad.

Tuesday’s rampage — which involved demonstrators hurling satellite dishes from the roof of the embassy and ransacking files — was spearheaded by hundreds of members of a volunteer militia that pledges fealty to the supreme leader. But it elicited a contrite statement from Ahmadinejad’s Foreign Ministry, which called the assault on the British sites “unacceptable.”

With pressure on Iran escalating amid reported advances in its nuclear program, Khamenei declared last week that the country would meet “threats with threats.” On Sunday, after a decision by Britain to intensify sanctions against Iran, the parliament here voted to expel the U.K. ambassador.

British Prime Minister David Cameron in a statement called the attack on the embassy compound “outrageous and indefensible.” He warned Iran’s leaders of “serious consequences.”

One consequence could be that other European nations will recall their ambassadors, removing a key channel of communication with Iran. Europe is still one of Iran’s largest trading partners and serves as a key conduit between the country and Washington, which severed ties after the U.S. Embassy in Tehran was taken over in 1979.

Demonstrators have for years protested in front of the British Embassy in downtown Tehran, but security forces had always prevented them from entering the compound. On Tuesday, they faced no resistance as they flooded through the blue steel gates; police intervened about an hour later, after much of the damage had been done.

“Attacking the U.K. Embassy paints a picture of a regime that is deeply distressed and flustered,” said Karim Sadjadpour, an expert on Iranian politics at the Carnegie Endowment for International Peace. Sadjadpour described the Basij militia members who stormed the compound as “government-controlled rent-a-mobs” who are at the beck and call of Iranian security forces.

During the rampage, young men holding cellphone cameras and wooden sticks replaced the Union Jack with the Iranian flag atop the embassy. They chanted “Death to England” and waved banners emblazoned with Islamic slogans as they set fires and scattered papers. British diplomats escaped through a back door, and none was reported to be injured. Members of Iran’s parliament — where pro-Khamenei sentiment runs high — lauded the raid.

The protesters removed a British coat of arms from the wall of a building, carried off a portrait of Queen Elizabeth II, and used boards and other wooden objects to smash windows. Iran’s English-language state television channel was allowed to film the entire scene — a marked departure from protocol at anti-government demonstrations, where media coverage is tightly restricted.

One of the protesters’ leaders — holding a microphone and standing on top of a truck — egged on the attackers, shouting, “Today we will close down the den of spies.” The term recalled the sobriquet used by young militants in November 1979 when they took over the U.S. Embassy in Tehran and accused its diplomats of espionage.

Underscoring the level of organization behind the attack, the demonstrators also infiltrated the British diplomats’ residential compound, about six miles north of the embassy complex. At least two vehicles there were set on fire and six embassy staff members were taken hostage for several hours before police freed them. The semiofficial Fars News Agency identified the six as “British staff members,” but there was no immediate confirmation from London that any British nationals were seized.

The European Union had been scheduled to debate new sanctions against Iran on Thursday, and Tuesday’s events appear likely to dim hopes of persuading the Islamic republic to negotiate over its nuclear program.

Iran’s international isolation has been increasing since last month, when U.S. authorities said they had discovered an alleged plot by Iran’s Revolutionary Guard Corps to assassinate the Saudi ambassador to the United States. That was followed this month by a highly critical report from the International Atomic Energy Agency, which concluded that Iran was working on triggers for a nuclear weapon. Iran maintains that its uranium-enrichment program is intended for peaceful purposes.

“This is a dangerous trend,” said Cliff Kupchan, a State Department official during the Clinton administration who is an Iran analyst at the Eurasia Group, a Washington consulting firm.

The international pressures brought to bear over the past two months, Kupchan said, have “produced a regime that feels increasingly cornered.”

Tuesday marked the first significant attack on a foreign target in Iran in several years. Student paramilitary leaders had called for a demonstration outside the embassy to commemorate the 2010 assassination of Majid Shahriari, a nuclear scientist killed in a car bombing. Iran’s government blames Israel and Western nations — including Britain — for the death.

The demonstration also focused on Britain’s decision last week to cut off all financial connections between Iranian and British banks, marking the first time a British government has severed all links to another country’s banking system. The United States also imposed additional restrictions on Iran, although it stopped short of penalizing the Central Bank of Iran, a move that some U.S. lawmakers had urged.

The White House condemned the assault on the British Embassy “in the strongest terms” and urged Iran “to protect the diplomatic missions present in its country and the personnel stationed at them.”

Iran’s Basij is a volunteer militia originally established by Ayatollah Ruhollah Khomeini, the leader of Iran’s 1979 Islamic revolution. It is affiliated with the elite Revolutionary Guard Corps and is loyal to Khomeini’s successor as supreme leader, Khamenei.

In recent years, the Basij has served as an auxiliary internal security force, playing a key role in breaking up demonstrations against Ahmadinejad’s government after disputed elections in 2009.

Warrick reported from Washington. Staff writers Karen DeYoung and William Branigin in Washington contributed to this report.