BENGHAZI, Libya — A mob enraged by a film ridiculing Islam's prophet killed the U.S. ambassador to Libya and three other Americans in a fiery attack on the U.S. Consulate in Benghazi. President Barack Obama strongly condemned the violence, vowed Wednesday to bring the killers to justice and tightened security at diplomatic posts around the world.

The attack that killed Ambassador Chris Stevens — the first U.S. diplomat to die in the line of duty since 1979 — came on Tuesday's 11th anniversary of the Sept. 11 terrorist strike and presented a new foreign policy crisis for the United States in a region trying to recover from months of upheaval.

Libya's interim president, Mohammed el-Megarif, apologized for what he called the "cowardly" assault on the consulate, which also killed several Libyan security guards in the eastern city. Just before the Benghazi violence, protests also flared in Egypt, where crowds angry over the film climbed the walls of the U.S. Embassy in Cairo and tore down an American flag, which they replaced briefly with a black, Islamist flag.

The protests were touched off by an obscure movie made in the United States by a filmmaker who calls Islam a "cancer." Video excerpts posted on YouTube depict the Prophet Muhammad as a fraud, a womanizer and a madman in an overtly ridiculing way, showing him having sex and calling for massacres.

But the brazenness of the embassy assaults — the first on U.S. diplomatic facilities in Libya and Egypt — were signs of the lawlessness that has taken hold in the two countries after revolutions ousted their autocratic secular regimes and upended the tightly controlled police state. Islamists have emerged as powerful forces, and security forces have largely broken down.

In Libya, the volatility is further compounded by the wide availability of heavy weapons and the numerous armed militia factions that remain more powerful than security forces.