Libyan authorities have made arrests in the investigation into the attack on the US consulate in Benghazi in which the US ambassador and three embassy staff were killed.

Gunmen staged a military-style assault on the consulate and a safe house refuge on Tuesday.

Christopher Stevens and three others died in the assault, carried out with guns, mortars and grenades. Eight Libyans were injured.

Earlier, demonstrators attacked the US embassies in Yemen and Egypt in protest at a film they consider blasphemous to Islam.

Hundreds of Yemeni demonstrators broke through the main gate of the heavily fortified compound in eastern Sanaa.

They smashed windows of security offices outside the embassy and burned cars.

A security source said at least 15 people were wounded, some by bullets.

A US embassy spokesman said its personnel were reported to be safe.

In Egypt, protesters hurled stones at a police cordon around the US embassy in central Cairo after climbing into the compound and tearing down the US flag.

Hundreds of demonstrators had gathered in the area, but a smaller group of those joined battles with police.

The Health Ministry said 224 people were injured, according to the state news agency, and 23 people were detained.

US President Barack Obama has thanked Yemen's President Abd-Rabbu Mansour Hadi for condemning an attack on the US embassy and launching an investigation, the White House said.

President Obama spoke by phone with Mr Hadi in the wake of demonstrations at the US embassy compound in Sanaa, where protesters broke through the main gate, smashed windows and burned cars.

"President Obama expressed appreciation for the cooperation we have received from the Yemeni government and underscored the importance of working together to ensure the security of US personnel going forward," the White House said in a statement.

The US military moved two navy destroyers towards the Libyan coast, in what a US official said was a move to give the administration flexibility for any future action against Libyan targets.

Mr Obama said security was being increased at US diplomatic posts around the globe and the US consulate in Berlin was partially evacuated after an employee fell ill on opening a suspicious envelope.

About 1,000 Bangladeshi Islamists tried to march on the US embassy in Dhaka after protests earlier in the week outside US missions in Tunisia, Sudan and Morocco.

The US military dispatched a Marine Corps anti-terrorist team to boost security in Libya.

The attack in Benghazi, which US officials said may have been planned in advance, came on the 11th anniversary of al-Qaeda's attacks on the United States on 11 September 2001.

The attackers were part of a mob blaming America for a film they said insulted the Prophet Muhammad.

Clips of the "Innocence of Muslims," had been circulating on the Internet for weeks before the protests erupted.

For many Muslims, any depiction of the Prophet is blasphemous and caricatures or other characterisations have in the past provoked protests all over the Muslim world.

Yemen, a key US 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.

The violence also could have an impact on the closely contested US presidential race ahead of the 6 November election.

Republican Mitt Romney criticised the president's response to the crisis.

He said the timing of a statement from the US embassy in Cairo denouncing "efforts by misguided individuals to hurt the religious feelings of Muslims" made Mr Obama look weak as protesters were attacking US missions.

The Obama campaign accused Mr Romney of trying to score political points at a time of national tragedy.

The attack raised questions about the future US diplomatic presence in Libya, relations between Washington and Tripoli, and the unstable security situation after Gaddafi's overthrow.

Egypt's Mursi condemns embassy attack

Egypt's President Mohamed Mursi has said he supported peaceful protests but not attacks on embassies, after Egyptians angry at the film deemed insulting to the Prophet Muhammad climbed into the US embassy in Cairo and tore down the American flag.

"Expressing opinion, freedom to protest and announcing positions is guaranteed but without assaulting private or public property, diplomatic missions or embassies," Mr Mursi, an Islamist who is Egypt's first freely-elected president, said.

He pledged to protect foreigners in Egypt.

The incident will test Mr Mursi's handling of ties with the United States, a close ally of Egypt under ousted President Hosni Mubarak and which has long been wary of Islamists.

Washington is a major aid donor to Cairo. Mubarak was toppled in a wave of popular protests.

The violence spurred by anti-US sentiment in Benghazi and Cairo has threatened to spread to other countries in the region.

An Iraqi militia that carried out some of the most prominent attacks on foreigners during the Iraq war has also threatened US interests in that country.

Police fired teargas at angry demonstrators outside the US embassy in Tunisia and several hundred people gathered in front of the US embassy in Sudan.

In Morocco, a few dozen protesters burned American flags and chanted slogans near the US consulate in Casablanca.

Afghan authorities have also ordered YouTube be shutdown "indefinitely" to stop Afghans watching the film.