President Obama has vowed to bring to justice those who carried out the attack that killed the US ambassador to Libya. But he said the US consulate attack in Benghazi would not harm ties between the US and the new Libyan government. It sparked a political row in the US, with rival Mitt Romney criticizing Mr Obama before the president hit back.
Speaking in the Rose Garden at the White House, President Obama told reporters: "Justice will be done." He condemned "in the strongest possible terms the outrageous and shocking" attack.
"It is especially tragic that Chris Stevens died in Benghazi because it is a city that he helped to save," he added, praising the dead ambassador for his work in Libya after the overthrow of the late Col Muammar Gaddafi.
Ambassador J Christopher Stevens died after gunmen stormed the consulate amid protests over an anti-Islamic film. Meanwhile, protesters in Egypt have clashed with security forces after crowds returned to the US embassy in Cairo for a second evening of demonstrations over the film. Riot police fired tear gas at protesters, some of whom were seen carrying gasoline bombs, witnesses said. The protests followed rallies in Cairo, where demonstrators angry at the film, called 'Innocence of Muslims', breached the walls of the US embassy and tore down the flag. Little is known with any certainty about the origins of the film, or about a man named as Sam Bacile, reported as being behind its production.
US officials said the consulate compound in Libya began taking heavy fire around 22:00 local time on Tuesday night, and the main building was in flames soon afterwards. Three other Americans were also killed, including Sean Smith, a state department employee, in what the White House described as a "complex" attack.
Libyan and US security forces tried to retake the compound several times, US officials said, but only succeeded early on Wednesday. Mr Smith was found dead inside the compound. They also cited reports suggesting al-Qaeda's north Africa-based affiliate, known as al-Qaeda in the Islamic Maghreb, may have been involved.
US officials said Washington was investigating whether the attack was organized in advance, rather than a spontaneous assault sparked by demonstrations over the film. Officials told Reuters there were suspicions that a militia known as the Ansar al-Sharia brigade was involved in the attack. The group has denied the claim. A US marine anti-terrorism team is being sent to Libya to bolster security after the attack.
Planned attack? Anybody's guess but past experience with terrorist organizations would suggest al-Qaeda had a hand in it. It also raises the question of why there was not more protection for the embassies on the anniversary of 9/11.
Earlier, the president was criticized by his Republican rival, Mitt Romney, who said the administration appeared to "sympathize with those who waged the attacks".
According to Mr Romney, Mr Obama's team had sent "mixed signals to the world" in the face of violence, referring to a statement from the US embassy in Cairo, issued before it was known Mr Stevens had been killed. Mr Romney stood by his criticism of the administration as events unfolded on Wednesday, despite a lack of firm support from his Republican party.
Later, in an interview with CBS on Wednesday, Mr Obama said that his election opponent had "a tendency to shoot first and aim later".
Libya's interim leader, Mohammed Magarief, apologized to the US over the killings, which he called "cowardly criminal acts". Libya's deputy envoy to the UN, Ibrahim Dabashi, promised an investigation.
Correspondents say the film at the heart of the row, which appeared on YouTube translated into Arabic, is highly provocative and insulting to Muslims. An Islamic tenet bans the portrayal of the Prophet Muhammad.
US media reaction
Time correspondent Ashraf Khalil describes the scene on the ground in Egypt and concludes the reaction to the film was "essentially a case of an American group of fringe Christian fundamentalists successfully provoking and enraging a similar group of fringe Muslim fundamentalists".
ABC's Jake Tapper explains the chronology of events in Egypt and Libya as the Romney campaign accused the White House on Tuesday of being sympathetic with those who waged the attacks.
NBC calls Mr Romney's criticism of the Obama administration "one of the most over-the-top and incorrect attacks of the general-election campaign".
In other developments on Wednesday:
- Nigeria placed its police force on red alert
- The US embassy in Algiers warned Americans in Algeria to avoid non-essential travel
- Tunisian police fired tear gas and rubber bullets into the air to disperse a protest near in Tunis
- Demonstrations were reported in Khartoum, Sudan, the US consulate in Casablanca, Morocco, and at UN offices in Gaza
- Afghanistan ordered a block on YouTube until the offending film was removed - but the site was still visible to users in Kabul