President Barack Obama has condemned attacks on the US consulate in eastern Libya that killed the US ambassador and three American members of his staff.

In a White House statement on Wednesday, Obama also said he had ordered “all necessary resources to support the security of our personnel in Libya, and to increase security at our diplomatic posts around the globe”.

The attacks occurred on Tuesday night in the eastern city of Benghazi by protesters angry over a film that ridiculed Islam’s Prophet Mohammed, according to Libya officials.

Ambassador Chris Stevens was killed when he and a group of embassy employees went to the consulate to try to evacuate staff as the building came under attack by a mob armed with guns and rocket propelled grenades. Three other Americans were also killed.

Obama called Stevens a “courageous and exemplary representative of the United States”.

“I strongly condemn the outrageous attack on our diplomatic facility in Benghazi,” Obama said in the statement. The four Americans, he said, “exemplified America’s commitment to freedom, justice, and partnership with nations and people around the globe.

“While the United States rejects efforts to denigrate the religious beliefs of others, we must all unequivocally oppose the kind of senseless violence that took the lives of these public servants,” Obama said.

US Secretary of State Hillary Clinton also paid tribute to the American dead, and identified a second of them as Sean Smith, a State Department information management officer.

The names of the other two officials were being withheld pending notification of next of kin.

“All the Americans we lost in yesterday’s attacks made the ultimate sacrifice,” Clinton said.

“We condemn this vicious and violent attack that took their lives, which they had committed to helping the Libyan people reach for a better future.”

Stevens was a career diplomat who spoke Arabic and French and had already served two tours in Libya, including running the office in Benghazi during the revolt against Libyan leader Muammar Gaddafi. He was confirmed as ambassador to Libya by the Senate earlier this year.

The US embassy in Algiers meanwhile is warning Americans in the country to avoid non-essential travel amid calls for protests after the attack on the US consulate in Libya.

The embassy said in an emergency message to US citizens that unspecified groups are using online social networks to organized demonstrations in front of the embassy on Wednesday “to protest a range of issues”.

It warns Americans to avoid large gatherings and non-essential travel in and around the embassy and other official buildings.