The violently anti-American rallies that have roiled the Islamic world over a video denigrating the Prophet Muhammad expanded on Friday to nearly a dozen countries, with demonstrators breaching the United States Embassy in Tunisia for the first time and protesters in Sudan’s capital broadening the targets to include Germany and Britain.

The broadening of the protests appeared unabated by calls for restraint from the new Islamist president of Egypt, where the demonstrations first erupted four days ago on the anniversary of the Sept. 11, 2001 attacks. In Washington, the Pentagon announced it was dispatching 50 Marines to secure the American diplomatic compound in Yemen’s capital, which was partly defiled by enraged protesters on Thursday. In Jalalabad, Afghanistan, protesters burned an effigy of President Obama.

The breaching of the United States Embassy in Tunis, the birthplace of the Arab Spring revolutions, was at least the fourth instance of a violation of American diplomatic facilities in the Middle East since the protests began. There were also unconfirmed reports from Tunis that protesters had torched an American school.

Germany’s foreign minister, Guido Westerwelle, told reporters at the Foreign Ministry in Berlin that the country’s embassy in Khartoum, Sudan, had been “stormed and in part set aflame” in an attack by “demonstrators capable of violence.” According to Mr. Westerwelle, embassy employees were safe. German missions in Muslim countries had already strengthened security measures because of the unrest.

In Sudan, the police fired tear-gas to stop about 5,000 demonstrators attempting to storm the German and British embassies in Khartoum to protest the video, a Reuters witness said in a report by the news agency.

Thousands of Palestinians joined demonstrations after prayers in the Gaza Strip. Since there is no American diplomatic representation in Gaza, the main gathering took place in Gaza City, outside the Parliament building, where American and Israeli flags were placed on the ground for the crowds to stomp. Some demonstrators chanted, “Death to America and to Israel!” Palestinains also clashed with Israeli security forces in Jerusalem and held protests in the West Bank.

Witnesses in Cairo said protests that first flared on Tuesday — the day J. Christopher Stevens, the American ambassador in Libya, was killed in an attack in neighboring Libya — continued sporadically Friday, with protesters throwing rocks and gasoline bombs near the American Embassy and the police firing tear gas. The bodies of Mr. Stevens and three other Americans killed in the Libya attack were being returned to the United States on Friday.

In Lebanon, one person was killed and 25 injured as protesters attacked restaurants, There was also turmoil in Yemen, Bangladesh, Qatar, Kuwait, and Iraq, demonstrations in Malaysia and heightened fears of an outbreak in Nigeria.

State media in Egypt said that more than 220 people had been injured in the clashes since Tuesday.

The widening unrest has challenged the Obama administration’s policy in the tinderbox region where the Arab Spring uprisings have removed many of the pro-American strongmen who once kept public displays of Islamic passion in check.

In Yemen, baton-wielding security forces backed by water cannons blocked streets near the American Embassy a day after protesters breached the outer security perimeter there and officials said two people were killed in clashes with the police. Still, a group of several dozen protesters gathered near the diplomatic post, carrying placards and shouting slogans.

In Lebanon, hundreds of protesters set alight a Kentucky Fried Chicken restaurant in the northern Lebanese city of Tripoli on Friday, witnesses said, chanting against the pope’s visit to the country and shouting anti-American slogans, according to a Reuters report.

In Iraq, where the heavily-fortified American embassy sits on the banks of the Tigris inside the Green Zone and is out of reach to ordinary Iraqis, thousands protested after Friday prayers, in Sunni and Shiite cities alike.

Raising banners with Islamic slogans and denouncing the United States and Israel, Iraqis called for the expulsion of American diplomats from the country and demanded that the American government apologize for the incendiary film and take legal action against its creators.

“We want the U.S. government to prove that there is justice by stopping this movie and punishing the director and his staff,” said Sheik Ahmad al-A’ani, a preacher at a mosque in Baghdad.

In Hilla, in the Shiite-dominated south, a witness reported the burning of American and Israeli flags. In Kufa, another Shiite town in the south, a mosque preacher declared his belief that the four Americans killed in the attack in Libya actually died at the hands of the American government to create a pretext for the United States to seek revenge and extend its presence in the region. And in Samarra, a Sunni city north of Baghdad that is near Saddam Hussein’s hometown Tikrit, preachers at local mosques demanded that Iraqis boycott American goods.

In Egypt, in particular, leaders scrambled to repair deep strains with Washington provoked by their initial response to attacks on the American Embassy on Tuesday, tacitly acknowledging that they erred in their response by focusing far more on anti-American domestic opinion than on condemning the violence.

The attacks squeezed President Mohamed Morsi and the Muslim Brotherhood between conflicting pressures from Washington and their Islamic constituency at home, a senior Brotherhood official acknowledged. During a 20-minute phone call Wednesday night, Mr. Obama warned Mr. Morsi that relations would be jeopardized if the authorities in Cairo failed to protect American diplomats and stand more firmly against anti-American attacks.