Editor's note: Read a version of this story in Arabic
SANAA, Yemen (CNN) -- Violent clashes outside the American Embassy in the Yemeni capital of Sanaa left 24 members of the security forces and three protesters injured Thursday, Yemen's Defense Ministry and eyewitnesses said.
Protesters and witnesses said the three protesters had been hurt, one critically, when police fired on them as they tried to disperse the angry crowd.
Demonstrators earlier breached a security wall at the embassy, as the mission was attacked amid escalating anti-American sentiment.
The protests are the latest to roil the Middle East over the online release of a film produced in the United States that denigrates Prophet Mohammed.
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.
The clashes follow Tuesday's attack on the U.S. Consulate in Benghazi, Libya, which 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 be rising again as the day wore on -- and security forces began to use more forceful measures to try to control the crowd.
The protesters' numbers had dropped to fewer than 100 by lunchtime, after security forces managed to defuse some of the tension, but rose again to several hundred after water cannon were used against the crowd.
Security forces have been given permission to shoot anyone seen with weapons near the embassy, two Interior Ministry officials told CNN. Shots have been heard in the area.
The security forces had earlier used batons to try to force the protesters, who burned tires and cars outside the embassy as well as an embassy flag, back behind barriers on the roads.
State Department officials said all embassy personnel were safe and accounted for but were currently in different locations, a Western diplomat told CNN.
A U.S. official in Yemen not authorized to speak publicly due to the sensitivity of the situation told CNN: "Everyone here is OK." He said there had been no evacuation.
Demonstrators said they wanted to express their anger over 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 unfold 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.
"All governments have a responsibility to protect those spaces and people, because to attack an embassy is to attack the idea that we can work together to build understanding and a better future."
In a statement released through the Yemeni Embassy in Washington, Yemen's 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."
Hadi's statement, which spoke of "warm relations" between his country and the United States, highlighted divisions among Yemeni security and military forces as creating an atmosphere where such disturbances could erupt.
Hadi has sought over the past several months to restructure the Yemeni security forces and remove loyalists to former President Ali Abdullah Saleh from their posts. Saleh was forced from power early this year following mass protests.
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 in the vicinity of the embassy, and urges Americans to leave the country.
"U.S. citizens who are already in Yemen should depart. The security threat to all U.S. citizens in Yemen remains critical," it says.
"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 witnessed in 2005 following the publication in Denmark of cartoons seen as disrespectful to Prophet 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.