President Barack Obama on Wednesday strongly condemned the killing of the U.S. ambassador to Libya and three other embassy staff as an "outrageous attack" and ordered increased security at U.S. diplomatic posts worldwide.

"I have directed my administration to provide all necessary resources to support the security of our personnel in Libya, and to increase security at our diplomatic posts around the globe," Obama said in a statement after the U.S. diplomats were killed in a rocket attack on their car in Benghazi.

"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," he said.

Libyan leader Mohammed Magarief apologised to the U.S. over the attack in a a news conference broadcast live on AlJazeera television.

"We apologise to the United States, the people and to the whole world for what happened," he said

A Libyan official told Reuters on Wednesday that the U.S. ambassador to Libya and three other embassy staff were killed Tuesday night in a rocket attack that targeted the envoy's car in the eastern Libyan city of Benghazi.

"The American ambassador and three staff members were killed when gunmen fired rockets at them," the official in Benghazi told Reuters.

The Libyan official said the U.S. ambassador had been on his way to a safer venue after protesters attacked the U.S. Consulate in Benghazi and opened fire, killing a staff member, in protest of a U.S. film that they deemed blasphemous to the Prophet Mohammed.