From Tunis to Cairo to Jakarta, Indonesia, the Muslim world erupted in protests aimed at the United States on Friday as anger over a video that mocks the prophet Muhammad boiled over into assaults on embassies or demonstrations in nearly two dozen countries.

As governments struggled to contain a wave of fury in which U.S. embassy compounds in Sudan and Tunisia were broken into and others were targeted, the violence appeared to overwhelm whatever goodwill was built up during the Arab Spring, when the United States tried to support many countries’ efforts toward democracy and freedom.

On Friday, it was the freedom to target American-linked buildings that most defined the day, as many governments appeared to be taken by surprise at the strength of the protests. Not even KFC and Hardee’s were safe, with franchises in Tripoli, Lebanon, torched by protesters as security forces opened fire on them, killing at least one person.

It was impossible to know how many of the thousands of demonstrators who filled streets outside U.S. outposts were motivated by reports about the video — which was made under mysterious circumstances, apparently by individuals in California — and how many were venting anger at the United States for other reasons. A short clip has been available on the Internet for weeks but apparently did not generate much attention until it was subtitled in Arabic and sent to Egyptian journalists.

The vehemence and volatile nature of the protests in capital after capital — images of which were broadcast around the globe almost instantly via blogs, social media networks and cable news stations — were unmistakable.

Anti-U.S. protests spread to Afghanistan, Bahrain, Bangladesh, Britain, East Jerusalem, Egypt, India, Indonesia, Iran, Iraq, Malaysia, Pakistan, Qatar, Syria, Turkey, the West Bank and Yemen, according to U.S. officials and news reports, with many protesters chanting religious slogans and railing against the denigration of Islam in the obscure low-budget video.

Embassies are targeted

In Tunisia, whose toppling of an autocrat in 2011 set the Arab Spring in motion, an American school was largely destroyed in Tunis, the capital, and protesters set fire to cars inside the U.S. Embassy parking lot. U.S. officials said Tunisian security provided a “very strong presence,” confronting stone-throwing crowds with tear gas and gunfire and pushing demonstrators out of the embassy compound.

In Khartoum, the Sudanese capital, buses full of protesters stormed the German Embassy and set it ablaze, then headed for the U.S. Embassy on the outskirts of the city. Thousands gathered there, and many were trying to climb the embassy walls when police opened fire. At least three protesters were seen motionless on the ground, according to the Associated Press.

In Washington, the White House acknowledged that it had sought to discourage distribution of the video that sparked the protests but insisted that it had made no formal request to the video-sharing Web site YouTube, which is owned by Google. Tommy Vietor, the National Security Council spokesman, said the White House had asked YouTube “to review whether it violates their terms of use.’’ Google said this week that it had blocked access to the video in Egypt and Libya.

President Obama made formal a previously announced decision to dispatch U.S. Marine quick-response teams to Libya and Yemen. In a letter to the House and Senate, Obama said that the security forces from the U.S. Africa Command “are equipped for combat,” although their purpose is solely to protect American citizens and property. Officials said plans are in motion to send a third team to Sudan, but said that they are awaiting agreement from that government, with which U.S. relations are strained.

Obama later joined Secretary of State Hillary Rodham Clinton as the bodies of four Americans killed in Tuesday’s attack on the U.S. Consulate in Benghazi, Libya, arrived at Andrews Air Force Base in Maryland from Germany aboard a military plane. The flag-draped transfer cases, including that of Ambassador J. Christopher Stevens, were carried solemnly to waiting hearses by Marines.

U.S. intelligence officials said they have tentatively concluded that the Libya assault was carried out by a group aligned with al-Qaeda but was not directed by the terrorist network’s core leadership. Still unable to reach the charred Benghazi compound, the officials have relied on intelligence from an array of sources, including news footage, intercepted phone calls and e-mails, and information from human sources recruited by the CIA, officials said.

A senior administration official, commenting on initial reports that the assault was planned, said that “currently available information suggests that the demonstrations in Benghazi were spontaneously inspired by the protests at the U.S. Embassy in Cairo,” which began several hours earlier Tuesday, “and evolved into a direct assault.”

“The crowd almost certainly was a mix of individuals,” the official said. “We do know that Islamic extremists participated in the violent demonstrations.”

Although the State Department initially provided sketchy details of the assault, spokeswoman Victoria Nuland said Friday that the consulate was now a “crime scene” under investigation by the FBI and no further information was available.

The White House has been in crisis mode since the Libya attack, with Deputy National Security Adviser Denis R. McDonough chairing twice-daily meetings of deputies from across the government. Obama’s top national security officials also have been holding regular sessions, according to an administration official who spoke on the condition of anonymity about internal deliberations.

Administration officials expressed relief late Friday that the day’s damage had not been worse and credited their own outreach to Muslim leaders — sometimes sternly expressed — for limiting it. Obama, Clinton and other senior officials have contacted governments in affected countries to urge them to take stands against the violence and remind them they were responsible for protecting American personnel and installations.

Overnight Thursday, Obama sent a personal message to Turkish Prime Minister Recep Tayyip Erdogan asking him to speak out. In a speech Friday that a senior administration official described as “really strong,” Erdogan said that “both the mentality and the organization behind this movie and those perpetrating terrorist actions exploiting Islamic symbols and discourse” were equally to be condemned.

Vice President Biden telephoned Sudanese Vice President Ali Osman Taha, and Clinton spoke Thursday with Afghan President Hamid Karzai.

Morsi in a tight spot

Obama’s most crucial call, administration officials said, was late Wednesday to Egyptian President Mohamed Morsi, chiding him for failing to condemn the initial assault on the Cairo embassy even as his Muslim Brotherhood organization called for further protests against the video.

Morsi appeared to have been jolted into attempting to tamp down public anger toward the United States and to fortify defenses around the embassy ahead of the protests on Friday, which has traditionally been the biggest day for demonstrations in the Muslim world.

But Morsi finds himself in a difficult position as the first democratically elected leader of a country where many people are anti-American, even as he wishes to preserve good relations with the U.S. government, which sends Egypt $1.6 billion a year in aid. That dilemma was underscored on Friday, when the Muslim Brotherhood again appeared to try to deliver two different messages: one in English to foreign audiences, saying in a posting on Twitter that it had canceled nationwide protests, and another statement in Arabic to its political base, calling for protests in front of mosques around the country.

Separately, Morsi appeared on state television to call for restraint and for Egyptians to respect the U.S. Embassy. State TV also repeatedly played a brief Thursday clip of Clinton dubbed into Arabic calling the low-budget anti-Islamic video “disgusting and reprehensible.”

The challenges that Morsi faces could be heard in the frustrations of many of the protesters.

“Morsi’s stance was halfway there,” said Roshy Kamel, 34, who had a thick beard typical of conservative Muslims. “We need him to suspend Egyptian-American relations and expel the American ambassador. We need him to show we are strong.”

DeYoung reported from Washington. Greg Miller in Washington and Haitham Tabei in Cairo contributed to this report.