Editor's note: Read a version of this story in Arabic.
Sanaa, Yemen (CNN) -- Anger over a film that denigrates the Prophet Mohammed spread to Yemen, where four protesters died Thursday during clashes with security forces outside the U.S. Embassy, according to Yemeni security officials.
Twenty-four security force members were reported injured, as were 11 protesters, according to Yemen's Defense Ministry, security officials and eyewitnesses.
Protesters and witnesses said one protester was critically injured when police fired on them as they tried to disperse the angry crowd.
The protests in Sanaa are the latest to roil the Middle East over the online release of the film produced in the United States.
As evening came, the number of protesters dwindled and tensions began to ease, after a day in which demonstrators breached a security wall and stormed the embassy amid escalating anti-American sentiment.
No embassy personnel were harmed, U.S. officials said.
In Egypt, riot police fired warning shots and tear gas early Thursday outside the U.S. Embassy in Cairo to keep hundreds of protesters back from the compound walls, with minor injuries reported. Protesters also gathered in Tunisia, Morocco, Iran and elsewhere.
The clashes follow Tuesday's attack on the U.S. Consulate in Benghazi, Libya, that left Ambassador Chris Stevens and three other consular officials dead and has heightened tensions at U.S. diplomatic missions across the region.
Thursday morning, several thousand Yemeni protesters gathered outside the U.S. Embassy in Sanaa, with some flooding the security perimeter and penetrating the embassy's wall, according to a statement released by Yemen through its embassy in Washington condemning the incident.
"Security services have quickly restored order to the embassy's complex. Fortunately, no casualties were reported from this chaotic incident," it said.
However, after a lull following the breach of the embassy wall, anger appeared to rise again as the day wore on, and security forces began to use more force to try to control the crowd.
There were fewer than 100 protesters by lunchtime, and tensions had eased, but their numbers rose to several hundred after water cannons were used against the crowd.
Security forces were given permission to shoot anyone seen with weapons near the embassy, two Interior Ministry officials told CNN, and gunshots were heard in the area.
By evening, the protesters, armed only with sticks and stones picked up from the street, had decreased in number and had been pushed back to about 300 yards from the embassy.
The protesters burned tires and an embassy flag, and smashed cars outside the embassy.
White House spokesman Jay Carney told reporters that all U.S. Embassy personnel were safe and accounted for and that the United States was doing all it could to protect them. The Yemeni government sent additional security personnel, he said.
A U.S. official in Yemen, who was not authorized to speak publicly because of the sensitivity of the situation, earlier told CNN: "Everyone here is OK." He said there had been no evacuation.
Demonstrators said they wanted to express their anger about the obscure movie after hearing of the protests in Libya and Egypt, although it was unclear how many of them have seen the offending video.
Yemeni human rights activist Ala'a Jarban, who was not part of the protest but watched events from a nearby rooftop, told CNN he thought what had happened was "really wrong."
"There were calls on social media to protest today in front of the embassy, so I expected there might be some violence and clashes, but didn't expect it would be that easy to break into the embassy," he said.
"I've been there -- it's one of the most protected places in Yemen. To break in that easily was a shock to me."
U.S. Secretary of State Hillary Clinton condemned the video Thursday as "disgusting and reprehensible" but said there was no justification for responding with violence.
"It is especially wrong for violence to be directed against diplomatic missions," she said. "These are places whose very purpose is peaceful, to promote better understanding across countries and cultures."
In a statement released through the Yemeni Embassy in Washington, President Abdu Rabu Mansour Hadi apologized to his U.S. counterpart, Barack Obama, and the American people for the attack on their mission in Sanaa.
Hadi ordered Yemeni authorities to "conduct an expeditious and thorough investigation" and said the protest was the work of a "rowdy group."
His statement, which spoke of "warm relations" between his country and the United States, said divisions among Yemeni security and military forces helped create an atmosphere where such disturbances could erupt.
Over the past several months, Hadi has sought to restructure Yemeni security forces and remove loyalists to former President Ali Abdullah Saleh from their posts. Saleh was forced from power early this year after mass protests.
European Union foreign policy chief Catherine Ashton condemned "in the strongest terms" the breaching of the perimeter wall and expressed the EU's "full solidarity" with the United States. Of the attack, the U.N. Security Council said that "terrorism in all its forms and manifestations constitutes one of the most serious threats to international peace and security, and that any acts of terrorism are criminal and unjustifiable, regardless of their motivation ..."
An emergency message on the website of the U.S. Embassy in Sanaa warns of the possibility of further protests in the coming days, particularly near the embassy, and urges Americans to leave the country.
"As staffing levels at the Embassy are restricted, our ability to assist U.S. citizens in an emergency remains limited and may be further constrained by the fluid security situation."
David Hartwell of security analysis group IHS Jane's told CNN the current protests were reminiscent in some ways of the outpouring of anger in 2005 after the publication in Denmark of cartoons seen as disrespectful to Mohammed.
The violence also reflects the changed dynamic in the region following the Arab Spring, Hartwell said.
"You've got populations in all of these countries who are now much more willing to take to the streets and are much more wiling to vocalize their anger in a much more violent way," he said.
"My guess is that this outpouring of anger will be intense but brief, but I think there is a danger that this anger will spread to perhaps more unpredictable places like Afghanistan and Pakistan."
CNN's Mohammed Jamjoom, Elise Labott and Becky Brittain, and journalist Hakim Almasmari in Sanaa contributed to this report.