CAIRO (AP) — Protesters angered over a film that ridiculed Islam's Prophet Muhammad fired gunshots and burned down the U.S. consulate in the eastern Libyan city of Benghazi, killing one American, witnesses and the State Department said. In Egypt, protesters scaled the walls of the U.S. Embassy in Cairo, and tore and replaced the American flag with an Islamic banner.

Tuesday's attacks were the first such assaults on U.S. diplomatic facilities in either country, at a time when both Libya and Egypt are struggling to overcome the turmoil following the ouster of their longtime leaders, Moammar Gadhafi and Hosni Mubarak, in uprisings last year.

The protests in both countries were sparked by outrage over a film ridiculing Muhammad produced by an Israeli filmmaker living in California and being promoted by an extreme anti-Muslim Egyptian Christian campaigner in the United States. Excerpts from the film dubbed into Arabic were posted on YouTube.

U.S. Secretary of State Hillary Rodham Clinton confirmed that one State Department officer had been killed in the protest at the U.S. consulate in Benghazi. She strongly condemned the attack and said she had called Libyan President Mohammed el-Megarif "to coordinate additional support to protect Americans in Libya."

Clinton expressed concern that the protests might spread to other countries. She said the U.S. is working with "partner countries around the world to protect our personnel, our missions, and American citizens worldwide."

"Some have sought to justify this vicious behavior as a response to inflammatory material posted on the Internet," Clinton said in a statement released by the State Department. "The United States deplores any intentional effort to denigrate the religious beliefs of others. Our commitment to religious tolerance goes back to the very beginning of our nation. But let me be clear: There is never any justification for violent acts of this kind."

In Benghazi, a large mob stormed the U.S. consulate, with gunmen firing their weapons, said Wanis al-Sharef, an Interior Ministry official in Benghazi. A witness said attackers fired automatic weapons and rocket-propelled grenades at the consulate as they clashed with Libyans hired to guard the facility.

Story continues

Outnumbered by the crowd, Libyan security forces did little to stop them, al-Sharef said.

The crowd overwhelmed the facility and set fire to it, burning most of it and looting the contents, witnesses said.

One American was shot to death and a second was wounded in the hand, al-Sharef said. He did not give further details.

The violence at the consulate lasted for about three hours, but the situation has now quieted down, said another witness.

"I heard nearly 10 explosions and all kinds of weapons. It was a terrifying day," said the witness who refused to give his name because he feared retribution.

Hours before the Benghazi attack, hundreds of mainly ultraconservative Islamist protesters in Egypt marched to the U.S. Embassy in downtown Cairo, gathering outside its walls and chanting against the movie and the U.S. Most of the embassy staff had left the compound earlier because of warnings of the upcoming demonstration.

"Say it, don't fear: Their ambassador must leave," the crowd chanted.

Dozens of protesters then scaled the embassy walls, and several went into the courtyard and took down the American flag from a pole. They brought it back to the crowd outside, which tried to burn it, but failing that tore it apart.

The protesters on the wall then raised on the flagpole a black flag with a Muslim declaration of faith, "There is no god but God and Muhammad is his prophet." The flag, similar to the banner used by al-Qaida, is commonly used by ultraconservatives around the region.

The crowd grew throughout Tuesday evening, with thousands standing outside the embassy. Dozens of riot police lined up along the embassy walls but did not stop protesters as they continued to climb and stand on the wall — though it appeared no more went into the compound.

The crowd chanted, "Islamic, Islamic. The right of our prophet will not die." Some shouted, "We are all Osama," referring to al-Qaida leader bin Laden. Young men, some in masks, sprayed graffiti on the walls. Some grumbled that Islamist President Mohammed Morsi had not spoken out about the movie.

A group of women in black veils and robes that left only their eyes exposed chanted, "Worshippers of the Cross, leave the Prophet Muhammad alone."

By midnight, the crowd dwindled. By early morning Wednesday, only about a dozen protesters remained, chanting "No God but Allah" for the benefit of news camera at the scene. Two bearded men nearby loudly debated about way to stop "America from harming the prophet."

Most streets leading up to the embassy reopened to traffic except for a side street employees use to enter the compound. Six Egyptian army armored vehicles were parked, next to a line of anti-riot police in helmets and body armor.

The embassy announced there will be no visa services on Wednesday.

A senior Egyptian security official at the embassy area said earlier on Tuesday night that authorities allowed the protest because it was "peaceful." When they started climbing the walls, he said he called for more troops, denying that the protesters stormed the embassy. He spoke on condition of anonymity because he was not authorized to speak to reporters.

The Cairo embassy is in a diplomatic area in Garden City, where the British and Italian embassies are located, only a few blocks away from Tahrir Square, the center of last year's uprising that led to the ouster of Mubarak. The U.S. Embassy is built like a fortress, with a wall several meters (yards) high. But security has been scaled back in recent months, with several roadblocks leading to the facility removed after legal court cases by residents.

The Egyptian Foreign Ministry promised in a statement to provide the necessary security for diplomatic missions and embassies and warned that "such incidents will negatively impact the image of stability in Egypt, which will have consequences on the life of its citizens."

One protester, Hossam Ahmed, said he was among those who entered the embassy compound and replaced the American flag with the black one. He said the group has now removed the black flag from the pole and laid it instead on a ladder on top of the wall.

"This is a very simple reaction to harming our prophet," said another, bearded young protester, Abdel-Hamid Ibrahim.

In Washington, State Department spokeswoman Victoria Nuland said Egyptian police had removed the demonstrators who entered the embassy grounds.

Muslims find it offensive to depict Muhammad in any fashion, much less in an insulting way. The 2005 publication of 12 caricatures of the Prophet Muhammad in a Danish newspaper triggered riots in many Muslim countries.

A 14-minute trailer of the movie that sparked the protests, posted on the website YouTube in an original English version and another dubbed into Egyptian Arabic, depicts Muhammad as a fraud, a womanizer and a madman in an overtly ridiculing way, showing him having sex and calling for massacres.

The website's guidelines call for removing videos that include a threat of violence, but not those that only express opinions. YouTube's practice is not to comment on specific videos.

Sam Bacile, a 56-year-old California real estate developer who identifies himself as an Israeli Jew and who said he produced, directed and wrote the two-hour film, "Innocence of Muslims," said he had not anticipated such a furious reaction.

Speaking by phone from an undisclosed location, Bacile, who went into hiding Tuesday, remained defiant, saying Islam is a cancer and that he intended his film to be a provocative political statement condemning the religion.

Bacile said he believes the movie will help his native land by exposing Islam's flaws to the world.

"Islam is a cancer, period," he repeatedly said in a solemn, accented tone.

Though Bacile was apologetic about the American who was killed in Benghazi, he blamed lax embassy security and the perpetrators of the violence.

"I feel the security system (at the embassies) is no good," said Bacile. "America should do something to change it."

Bacile said the film was produced in English and he doesn't know who dubbed it in Arabic. The full film has been shown once, to a mostly empty theater in Hollywood earlier this year, he said.

Morris Sadek, an Egyptian-born Christian in the U.S. known for his anti-Islam views, told The Associated Press from Washington that he was promoting the video on his website and on certain TV stations, which he did not identify.

Both depicted the film as showing how Coptic Christians are oppressed in Egypt, though it goes well beyond that to ridicule Muhammad — a reflection of their contention that Islam as a religion is inherently oppressive.

"The main problem is I am the first one to put on the screen someone who is (portraying) Muhammad. It makes them mad," Bacile said. "But we have to open the door. After 9/11 everybody should be in front of the judge, even Jesus, even Muhammad."

For several days, Egyptian media have been reporting on the video, playing some excerpts from it and blaming Sadek for it, with ultraconservative clerics going on air to denounce it.

Medhat Klada, a representative of Coptic Christian organizations in Europe, said Sadek's views are not representative of expatriate Copts.

"He is an extremist ... We don't go down this road. He has incited the people (in Egypt) against Copts," he said, speaking from Switzerland. "We refuse any attacks on religions because of a moral position."

But he said he was concerned about the backlash from angry Islamists, saying their protest only promotes the movie. "They don't know dialogue and they think that Islam will be offended from a movie."

___

Associated Press writers Bradley Klapper in Washington, Shaya Tayefe Mohajer in Los Angeles, and Esam Mohamed in Tripoli, Libya, contributed to this report.