US President Obama vowed on Wednesday to hunt down the killers of US ambassador Chris Stevens and three other Americans during an assault on its mission in Benghazi as suspicion grew that the diplomat was the victim of an organised attack by a militant group.
"Make no mistake: Justice will be done," Obama said at the White House. He described the killing, the first of a US ambassador since 1979, as "outrageous and shocking".
Crucially, though, the president made it clear that the US would work alongside the Libyan government to track down those responsible and would not be turning its back on the Arab spring in Libya or elsewhere in the Middle East.
"This attack will not break the bonds between the United States and Libya," he said.
One witness told the Guardian that a mob fired at least one rocket at the consulate building then stormed it, setting everything ablaze. Stevens is understood to have died from smoke inhalation. Several Libyan security officers were also reported to have been killed in the attack.
The Libyan government expressed deep regret over the attack. The country's interim leader, Mohammed Magarief, apologised, calling the killings "cowardly criminal acts" and part of a campaign "to impede our democratic experiment".
The FBI is being dispatched to Libya to help with the hunt, as well as 50 marines to reinforce the Tripoli embassy. Two US warships were reportedly heading towards the Libyan coast on Wednesday night. US surveillance drones are being redeployed to search for suspects among alleged jihadist camps in east Libya.
The state department ordered the evacuation of all non-essential staff from the country.
US Secretary of State Hillary Clinton blamed the killings on "a small and savage group". CNN reported a senior US official saying the assault was planned to coincide with the anniversary of the 9/11 attacks on New York and Washington and that those responsible used protests over a film mocking the Prophet Muhammad as cover. The fact that a rocket-propelled grenade was used was cited as evidence.
Congressman Mike Rogers, head of the House intelligence committee, who is usually briefed by the intelligence agencies during a crisis, said details were still fuzzy but it was "a well coordinated attack", one in which he said he could see the "signature of al-Qaeda" and a link to the 9/11 anniversary.
Rogers, a former FBI agent, told CNN: "It has all the hallmarks of an al-Qaeda-style event."
Jay Carney, Obama's White House spokesperson, responding to a question from a journalist whether the consulate attack was planned, said: "It's too early for us to make that judgment."
Mohammed el-Kish, a former official with the National Transitional Council, which handed power to an elected parliament last month, blamed the attack on hardline jihadists, as did the Quilliam think-tank in London which tracks jihadist groups.
But other officials cautioned against jumping to conclusions, suggesting that the attack was more likely to have been opportunistic than planned many days in advance.
The killings led to a political row between Obama and his Republican presidential rival Mitt Romney. In what may turn out to be one of the defining moments in the race for the White House, Romney attempted to pin some of the blame on the Obama administration, accusing it of being an apologist for American values.
It was a badly-handled, confused intervention that immediately backfired, with former diplomats, foreign policy analysts and even fellow-Republicans accusing Romney of behaving in an unpresidential manner, making political points with the American corpses barely cold.
Stevens (52) a career diplomat since 1991, had been a strong backer of the rebels, going into Benghazi at the height of the revolt aboard a cargo ship.
Also killed was another diplomat, Sean Smith, an air force veteran who was based in the Hague but was on temporary transfer to Libya. The other two Americans were security staff.
The attack in Benghazi came after a protest at the US embassy in Cairo on Tuesday afternoon over an American-produced amateur film denigrating Muslims. This was ostensibly the motive behind the protests in Benghazi too.
It was supposedly made by a Californian real estate developer called Sam Bacile, and both the Associated Press and the Wall St Journal had quoted somebody using that name saying that he was in hiding.
But by Wednesday evening, there were signs that Bacile did not exist and it was unclear who was behind the production. Cast members said they had been duped into making it and that anti-Islamic dialogue had been dubbed on later.
Obama, in an apparent swipe at the film, said the US was a nation that respected all faiths and "we reject all efforts to denigrate the religious beliefs of others". In spite of that, he added: "There is no justification for this senseless violence. None. The world must stand together to unequivocally reject these brutal acts."
The ambassador's killing follows an attack in June on the UK ambassador to Libya, Dominic Asquith. Two British bodyguards were injured after a rocket was fired at Asquith's convoy in Benghazi. There have been similar attacks on the Red Cross and the UN premises. The UK foreign secretary, William Hague, condemned the attack as "brutal and senseless".
According to the Libya Herald, which cited local witnesses, the killers included members of the hardline militant group Ansar al-Sharia. But a spokesperson, Hani al-Mansouri, told the Guardian the allegation was false.
Noman Benotman, a former Libyan jihadi who now runs the Quilliam think-tank in London, said he had information it was a terrorist attack that was planned to avenge Abu Yahya al-Libi, al-Qaeda's Libyan second-in-command, who was killed in a US drone strike a few months ago.
Egypt's President Mohammed Morsi, who used to lead the country's Muslim Brotherhood, was criticised for not speaking out to condemn the Cairo incident. But he asked the Egyptian embassy in Washington to take legal action in the US against the makers of a film.
The Brotherhood called for nationwide protests on Friday outside all main mosques. "The president has to balance between his domestic alliances with ultraconservative militants and Egypt's relations with the US on the foreign affairs front," said analyst Khalil a-Anani.
As anger over the film spread across the Muslim world, the Afghan government gave orders for YouTube to be closed to the public until the offending film was removed, though the site was still visible to internet users in Kabul. – © Guardian News and Media 2012, with additional reporting by Luke Harding, Chris Stephen and Sarah Sirgany.