Read this story in Arabic.
Cairo (CNN) -- The United States said it was taking measures to protect its citizens worldwide after protesters angry about an online film considered offensive to Islam attacked U.S. diplomatic compounds in Libya and Egypt on Tuesday, killing an American.
In Cairo, several men scaled the walls of the U.S. Embassy and tore down its American flag, according to CNN producer Mohamed Fadel Fahmy, who was on the scene.
In Libya, witnesses say members of a radical Islamist group called Ansar al-Sharia protested near the U.S. Consulate in Benghazi, where NATO jets established no-fly zones last year to blunt ground attacks from then Libyan strongman Moammar Gadhafi.
The group then clashed with security forces in the city, blocking roads leading to the consulate, witnesses said.
A U.S. State Department officer was killed in the violence in Benghazi, Secretary of State Hillary Clinton said in a statement late Tuesday.
"We are heartbroken by this terrible loss," Clinton said. "Our thoughts and prayers are with his family and those who have suffered in this attack."
Clinton said that she condemned the attack on the U.S. facilities "in the strongest terms" and that following Tuesday's events, the U.S. government was "working with partner countries around the world to protect our personnel, our missions and American citizens worldwide."
Libya's General National Congress also condemned the attack, saying it "led to the regrettable injury and death of a number of individuals." Lawmakers said in a statement Tuesday night that they were investigating.
It was unclear whether the two attacks were coordinated, CNN national security contributor Fran Townsend said Tuesday night.
"One such breach of an embassy or consulate's walls or security on any given day would be tremendous news. ... The fact that two of them happened on the same day that is the 9/11 anniversary where Americans are remembering those that we lost, you have to ask yourself, what are American officials trying to understand about this and whether or not these two are related?" she asked.
In Egypt, police and army personnel formed defensive lines around the U.S. Embassy in an effort to prevent demonstrators from advancing, but not before the protesters affixed a black flag atop a ladder in the American compound.
The black flag, which hangs in full view from inside the complex, is adorned with white characters that read, "There is no God but Allah and Mohammed is his messenger," an emblem often used by Islamic radicals.
A volley of warning shots were fired, as a large crowd gathered around the compound, although it is not clear who fired the shots.
Egyptian groups point to U.S. websites, including YouTube, that have scenes from the film. Some anti-Muslim blogs also have flagged the movie.
In a series of disjointed scenes, the film depicts Prophet Mohammed as a child molester, womanizer and ruthless killer.
The movie was made by Sam Bacile, an Israeli-American real-estate developer, according to the Wall Street Journal.
Bacile -- who wrote, directed and produced the film -- said he wanted to showcase his view of Islam as a hateful religion, the Journal reported, citing a telephone interview with him.
Bacile, 52, told the newspaper that to make the film, he had raised $5 million from about 100 Jewish donors, who he declined to identify. He said he made the two-hour movie over a three-month period last year in California, using about 60 actors and 45 crew members, the Journal reported.
Most of the Muslim world considers depictions of Mohammed to be blasphemous and deeply offensive.
"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. Our commitment to religious tolerance goes back to the very beginning of our nation."
But she stressed that "there is never any justification for violent acts of this kind."
Embassy officials issued a warning to Americans in Egypt, telling them to avoid the demonstrations which "may gather in front of the U.S. Embassy, or Egyptian government buildings such as the People's Assembly and Ministry of Interior."
"It is unclear if large numbers will take to the streets, but clashes may occur should two opposing groups come into contact with one another," the U.S. Embassy said in a statement. "Large gatherings and non-essential travel in and around downtown and Garden City should be avoided this afternoon."
Frenzied protesters could been seen Tuesday afternoon holding up bits of a shredded American flag to television camera crews while chanting anti-U.S. slogans.
An embassy phone operator told CNN that the compound had been cleared of diplomatic personnel earlier in the day ahead of the apparent threat, while Egyptian riot police and the army were called in.
"This is an expression of a feeling that is thought to be an insult," said Nizih El Naggary, a spokesman for the Egyptian Foreign Ministry. "But events like this are extremely deplorable. And we have to work to get things under control."
The Foreign Ministry issued a statement Tuesday, pledging to protect embassies and warning of the protests' potentially debilitating effects on the Egyptian economy.
"There are police forces at the demonstrations," El Naggary said. "They should be protecting the embassy and asking people to leave."
Several individuals claimed responsibility for organizing the demonstrations Tuesday, including Salafist leader Wesam Abdel-Wareth, who is president of Egypt's conservative Hekma television channel.
Mohamed al-Zawahiri -- the brother of al Qaeda leader Ayman al-Zawahiri -- added, "We called for the peaceful protest joined by different Islamic factions including the Islamicc Jihad (and the) Hazem Abu Ismael movement."
"We were surprised to see the big numbers show up, including the soccer Ultra fans," he said. "I just want to say, how would the Americans feel if films insulting leading Christian figures like the pope or historical figures like Abraham Lincoln were produced?"
He added that "the film portrays the prophet in a very ugly manner, alluding to topics like sex, which is not acceptable."
The U.S. Embassy in Cairo announced that it had canceled visa services for Wednesday.
It also said in a statement that it "condemns the continuing efforts by misguided individuals to hurt the religious feelings of Muslims -- as we condemn efforts to offend believers of all religions."
"Respect for religious beliefs is a cornerstone of American democracy," the statement said. "We firmly reject the actions by those who abuse the universal right of free speech to hurt the religious beliefs of others."
The embassy statement set off a political spat back in the United States after the Republican presidential nominee, Mitt Romney, criticized its message and linked it to his opponent for the White House.
"It's disgraceful that the Obama Administration's first response was not to condemn attacks on our diplomatic missions, but to sympathize with those who waged the attacks," Romney said in a statement released late Tuesday.
He said he was "outraged" by the attacks in Libya and Egypt.
The Obama campaign quickly responded to Romney's comments.
"We are shocked that, at a time when the United States of America is confronting the tragic death of one of our diplomatic officers in Libya, Governor Romney would choose to launch a political attack," Ben LaBolt, an Obama campaign spokesman said in an email.
Demonstrations elicited a mixture of reactions from the Egyptian street, where last year tens of thousands turned out in opposition to former Egyptian President Hosni Mubarak.
This summer, Egypt's first Islamist president, Mohamed Morsy, was sworn into power at Tahrir Square, the scene of the nation's revolution in 2011.
Though Tuesday's embassy protests are the first that Morsy has dealt with, Egypt recently produced similar scenarios when protesters attacked the Israeli and Syrian embassies in unrelated episodes.
"These protests are a bad image for Egypt," said a Cairo street vendor named Ahmed. "Of course I'm against insulting Islam, but it's the undereducated, poor people who are out here causing problems."
"All I want for Egypt is security and stability," he said. "And as you can see this isn't it."
The incident occurred on the 11th anniversary of the 9/11 attacks as crowds gathered across the United States in somber remembrance of a day that left nearly 3,000 people dead.
Tuesday's focus on the controversial film also drew comparisons to outcry generated from a 2008 movie produced by an anti-Muslim Dutch lawmaker to portray Islam as a violent religion.
Geert Wilders' film "Fitna," which he released online, featured images of terrorist acts superimposed over verses from the Quran.
CNN's Ian Lee in Cairo, Jomana Karadsheh, Matt Smith, Brian Walker, Elise Labott, Paul Cruickshank and Tracy Doueiry contributed to this report