SANAA, Yemen — Chanting “death to America” and “death to Israel,” hundreds of protesters angered by an anti-Islam film stormed the US Embassy compound in Yemen’s capital and burned the American flag on Thursday, the latest in a series of attacks on American diplomatic missions in the Middle East.

The string of assaults this week, in Yemen, Egypt and the storming of a US consulate in Libya that killed four Americans, point to an increased boldness among Islamists who have become more powerful since last year’s wave of revolts toppled authoritarian leaders.

The anger over the movie denigrating Islam’s Prophet Muhammad has also put the region’s new leaders — some of whom are themselves Islamists — in a difficult corner, between a base demanding a free hand to respond to the insult and US pressure to crack down. In the past, protests have broken out over perceived insults to Islam from the West, but in Arab countries they never escalated to the degree of breaching embassies, suggesting now hard-liners feel they can act with impunity.

US EMBASSIES STEP UP SECURITY AS OBAMA SPEAKS WITH LIBYAN, EGYPTIAN PRESIDENTS

US CONSULATE IN BERLIN EVACUATED AFTER SMELL REPORTED FROM ENVELOPE

Yemen’s president, Abed Rabbo Mansour Hadi, quickly apologized to the US for the embassy attack and vowed track down the culprits, just as Libya’s president did. Egypt’s Islamist President Mohammad Morsi, who had been slow to speak out on Tuesday’s assault on the embassy in Cairo, promised Thursday that his government would not allow attacks on diplomatic missions.

US officials suspect the Libya assault may have been a planned terror operation rather than a spontaneous mob assault. While protesters in other countries were unarmed, a crowd bristling with machine guns and rocket-propelled grenades overwhelmed the consulate in Benghazi late Tuesday, killing the ambassador and three other Americans.

Protests are also erupting in other countries. In Egypt, protesters clashed with riot police who had pushed them away from the embassy the night before.

In Iraq, several hundred Shiite hardliners protested in Baghdad’s Shiite stronghold of Sadr City. The leader of an Iranian-backed Shiite militia that previously attacked US troops, Asaib Ahl al-Haq, threatened anti-US attacks.

The movie “will put all the American interests in Iraq in danger,” the militia leader, Qais al-Khazali, told The Associated Press.

In Iran, about 50 protesters shouted, “Death to America,” outside the Swiss Embassy, which looks after US diplomatic interests in Iran. Riot police kept the crowd away from the building.

Hundreds converged Thursday on the US Embassy in the Yemeni capital Sanaa, which is heavily barricaded because of past al-Qaida-linked attacks on the compound. Yemeni guards at checkpoints on roads leading up to the compound did nothing to stop the crowd, said Ahmed Darwish, a witness who was at the scene.

The crowd swarmed over embassy’s entrance gate. Men with iron bars smashed the thick, bullet-proof glass windows of the entrance building while others clambered up the wall. Some ripped the embassy’s sign off the outer wall.

Inside the compound grounds, they brought down the American flag in the courtyard and replaced it with a black banner bearing Islam’s declaration of faith — “There is no God but Allah.” They did not enter the main building housing the embassy’s offices, some distance away from the entry reception. Demonstrators set tires ablaze and pelted the compound with rocks.

Yemeni security forces who rushed to the scene fired in the air and used tear gas to disperse the demonstrators, driving them out of the compound after about 45 minutes and sealing off the surrounding streets.

The Embassy said nobody was harmed in the attack. “All embassy personnel are safe and accounted for,” spokesman Lou Fintor said.

Hadi, the president, offered his “sincere apologies” for the attack and promised to catch those behind it. He said the attack was carried out by a “rowdy crowd” as part of a conspiracy to derail Yemen’s close relations with Washington.

The assault appeared to be a copy-cat of the protest Tuesday night at the US Embassy in Cairo, when angry youths climbed the walls and brought down the flag, though they largely refrained from any material damage.

Yemen is home to al Qaeda’s most active branch and the United States is the main foreign supporter of the Yemeni government’s counterterrorism campaign. The government on Tuesday announced that al Qaeda’s No. 2 leader in Yemen was killed in an apparent US airstrike, a major blow to the terror network.

The spreading violence comes as outrage grows over a movie called “Innocence of Muslims” produced by anti-Islam campaigners in the US that mocked Islam’s Prophet Muhammad. The amateurish video was produced in the US and excerpted on YouTube. It depicts Muhammad as a fraud, a womanizer and a madman in an overtly ridiculing way, showing him having sex and calling for massacres.

Egyptian protesters clashed Thursday with police near the US Embassy in Cairo. Police used tear gas to disperse the protesters and the two sides pelted each other with rocks. But unlike Tuesday, the police kept the protesters away from the embassy’s compound.

The Interior Ministry, which is in charge of police, said 16 protesters and 13 policemen were wounded in the clashes, which broke out overnight and were ongoing. Twelve protesters have been arrested, it said.

Egyptian President Mohammed Morsi, speaking while on a visit to Brussels, vowed on Thursday not to allow attacks on foreign embassies in Cairo, saying the Egyptian people reject such “unlawful acts.”

Afghanistan’s government, meanwhile, sought to avert any protests as past anger over perceived insults to Islam has triggered violence in the country.

President Hamid Karzai canceled an official visit to Norway and spoke by phone with US President Barack Obama to convey his condolences for the deaths of the US ambassador to Libya and three other diplomats, a statement said. He also discussed the “film and the insulting of holy Islamic values,” but the statement provided no other details.