(Reuters) - Demonstrators attacked the U.S. embassies in Yemen and Egypt on Thursday in protest at a film they consider blasphemous to Islam and American warships headed to Libya after the death of the U.S. ambassador there in related violence earlier in the week. Hundreds of Yemeni demonstrators broke through the main gate of the heavily fortified compound in eastern Sanaa, shouting "We sacrifice ourselves for you, Messenger of God". Earlier they smashed windows of security offices outside the embassy and burned cars. "We can see a fire inside the compound and security forces are firing in the air. The demonstrators are fleeing and then charging back," one witness told Reuters. A security source said at least 15 people were wounded, some by bullets. An embassy spokesman said its personnel were reported to be safe. In Egypt, protesters hurled stones at a police cordon around the U.S. embassy in central Cairo after climbing into the embassy and tearing down the American flag. The state news agency said 13 people were injured in violence which erupted on Wednesday night after protests on Tuesday. A day earlier, Islamist gunmen staged a military-style assault on the U.S. consulate and a safe house refuge in Benghazi, eastern Libya. The U.S. ambassador Christopher Stevens and three other Americans died in the assault, carried out with guns, mortars and grenades. Eight Libyans were injured. U.S. President Barack Obama vowed to "bring to justice" the Islamist gunmen responsible and the U.S. military moved two navy destroyers towards the Libyan coast, in what a U.S. official said was a move to give the administration flexibility for any future action against Libyan targets. The military also dispatched a Marine Corps anti-terrorist security team to boost security in Libya, whose leader Muammar Gaddafi was ousted in a U.S.-backed uprising last year. The attack, which U.S. officials said may have been planned in advance, came on the 11th anniversary of al Qaeda's attacks on the United States on September 11, 2001. The attackers were part of a mob blaming America for a film they said insulted the Prophet Mohammad. Clips of the "Innocence of Muslims," had been circulating on the Internet for weeks before the protests erupted. They show an amateurish production portraying the Prophet Mohammad as a womanizer, a homosexual and a child abuser. For many Muslims, any depiction of the Prophet is blasphemous and caricatures or other characterizations have in the past provoked protests all over the Muslim world. An actress in the California production said the video as it appeared bore no resemblance to the original filming. She had not been aware it was about the Prophet Mohammad. Among the assailants, Libyans identified units of a heavily armed local Islamist group, Ansar al-Sharia, which sympathizes with al Qaeda and derides Libya's U.S.-backed bid for democracy. U.S. officials said some reporting from the region suggested members of al Qaeda's north-Africa based affiliate may have been involved. Yemen, a key U.S. ally, is home to Al Qaeda in the Arabian Peninsula (AQAP), viewed by Washington as the most dangerous branch of the militant network established by Osama bin Laden. Obama said he had ordered an increase in security at U.S. diplomatic posts around the globe. Protests also erupted this week outside U.S. missions in Tunisia, Sudan and Morocco. The attacks could alter U.S. attitudes towards the wave of revolutions across the Arab world that toppled secularist authoritarian leaders in Egypt, Libya and Tunisia and brought Islamists to power.