President Barack Obama vowed on Friday to "stand fast" against violent anti-American protests sweeping the Muslim world as he honored the return of the remains of the U.S. ambassador and three other Americans killed in an attack in Libya this week.

Leading a somber ceremony with the flag-draped caskets of the Libya dead laid out beside him, Obama pledged to do everything possible to protect U.S. diplomats abroad and said he would hold foreign governments responsible for helping to safeguard them.

"The United States will never retreat from the world," Obama told a crowd that included grieving family members, diplomatic personnel and military service members inside a vast aircraft hangar at Andrews Air Force Base outside Washington.

Obama spoke as growing fury about a film that insults the Prophet Mohammed tore across the Middle East and other parts of the Muslim world after weekly prayers on Friday, with protesters attacking U.S. embassies and burning American flags as the

Pentagon rushed to bolster security at U.S. missions.

The obscure California-made film triggered an attack on the U.S. consulate in the Libyan city of Benghazi that killed U.S. Ambassador Christopher Stevens and three other Americans on Tuesday, the anniversary of the Sept. 11, 2001 al-Qaida attacks on the United States.

The attack and the spread of anti-U.S. violence to other Muslim countries have raised questions about Obama's handling of the Arab Spring revolutions of the past year even as he seeks re-election in November in a closely contested race.

The wave of attacks has reverberated into the presidential campaign, with Republican challenger Mitt Romney and his allies seizing the chance to reassert their accusations that Obama has weakened U.S. global leadership.

U.S. resolve

Obama acknowledged "these are difficult days" but expressed firm resolve.
"We will bring to justice those who took them from us. We will stand fast against the violence on our diplomatic missions," he said.

"We will continue to do everything in our power to protect Americans serving overseas, whether that means increasing security at our diplomatic posts, working with host countries which have an obligation to provide security, and making it clear that justice will come to those who harm Americans," he said.

The ceremony was held to honor the return to U.S. soil of the bodies of Stevens, State Department information management officer Sean Smith and security personnel Tyrone Woods and Glen Doherty, both former Navy SEALS.

Some U.S. officials believe the deadly attack could have been plotted in advance, but White House spokesman Jay Carney said on Friday he had no information suggesting the assault on the Benghazi consulate was "pre-planned."

Clinton repeated that the U.S. government had nothing to do with the making of the inflammatory film, and she insisted the violent response was "totally unacceptable."

 She said countries like Egypt, Tunisia and Libya, which had cast off authoritarian rulers, "did not trade the tyranny of a dictator for the tyranny of the mob.”

At the start of the ceremony, Marine pallbearers hoisted the caskets one by one from a military cargo plane and carried them into the hangar while a military band played somber music. As Obama spoke, he was flanked by four hearses.

The remains were to be flown to a military mortuary at an air base in Dover, Delaware.