The United States vowed to stand by Libya on Wednesday despite the killing of the US ambassador and three colleagues by Islamist militants on the anniversary of the September 11 attacks.
President Barack Obama and Secretary of State Hillary Clinton paid tribute to the slain envoy, Ambassador Chris Stevens, and said its mission would not waver in its support for Libya's shaky attempt to build democratic rule.
Obama's Republican challenger in the upcoming US presidential race, Mitt Romney, sounded the only off note -- accusing the White House of "sympathizing" with Muslim protesters angered by an amateur US movie that lampoons Islam.
The Obama campaign dismissed the charge, and the president himself rose above the fray to issue a solemn statement, flanked by Clinton in the Rose Garden of the White House, denouncing the attack, which also left between three to five US staff wounded.
"The United States condemns in the strongest terms this outrageous and shocking attack," he said. "Make no mistake, we will work with the Libyan government to bring to justice the killers who attacked our people."
"The attack will not break the bonds between the United States and Libya," he said, paying tribute to the actions of the new Libyan government, which is trying to unite the country after last year's overthrow of Moamer Kadhafi.
US officials said it was unclear who was behind the attack.
"We are not in a position to speak any further to the perpetrators of this attack. It was clearly a complex attack. We're going to have to do a full investigation," a senior US official said. An FBI probe is already underway.
Libya's deputy ambassador to the United Nations, Ibrahim Dabbashi, said up to 10 members of the Libyan security forces were hurt or killed in their failed attempt to protect the compound belonging to their US ally.
The US official said Stevens became separated from his security detail when the militants stormed a building in the compound, which caught fire in the attack.
"Security personnel were endeavoring to get him out of the building when they got separated by the incredibly thick smoke and fire," the official said, asking to remain anonymous.
Somehow Stevens got out and reached a local hospital, and his body was later returned to US officials at Benghazi airport. The senior US official said it was unclear how he got to the hospital or when he died, adding the cause of death would not be known until an autopsy was carried out.
Meanwhile, the United States is evacuating all its US staff from Benghazi, who were being flown to Germany where the wounded will be treated, and has cut staff at the embassy in Tripoli to emergency levels.
A detachment of Marines is also being dispatched to secure the main embassy in the Libyan capital Tripoli.
Benghazi in eastern Libya was the cradle of the NATO-backed revolt against Kadhafi's regime. Its streets are now prey to a variety of tribal and Islamist militia groups.
The assault, in which the US offices were burned and rocket-propelled grenades were fired, followed an earlier protest in Cairo, the capital of Egypt, in which hardline Salafist Islamists stormed the US embassy compound.
No one was hurt in Cairo, but the US flag was torn down and replaced by the black banner favored by supporters of militant groups like Al-Qaeda, in a protest triggered by the emergence on the Internet of an anti-Muslim film.
The US-made amateur production, which was recently dubbed into Arabic and broadcast in part on some Egyptian-based television networks, mocks and insults Islam's revered prophet, Mohammed.
Four hours before the Cairo protest began, the US embassy in the Egyptian capital issued a short statement indirectly criticizing the film by condemning "efforts by misguided individuals to hurt the religious feelings of Muslims."
For Romney, this amounted to Obama's administration "sympathizing with those who had breached our embassy in Egypt instead of condemning their actions."
Later in the day, Obama lashed out at Romney, questioning his tendency to "shoot first and aim later."
But Clinton had insisted that anger over the film's content could in no way justify either the protest in Cairo nor the attack in Libya.
"Some have sought to justify this vicious behavior as a response to inflammatory material posted on the Internet," Clinton said.
"The United States deplores any intentional effort to denigrate the religious beliefs of others.... But let me be clear: There is never any justification for violent acts of this kind."