President Barack Obama vowed Wednesday the United States would “work with the Libyan government to bring to justice” those who killed U.S. ambassador Chris Stevens and three other American personnel in an attack on the consulate in Benghazi.

“Make no mistake. Justice will be done,” he said in an appearance at the Rose Garden outside the White House, where he was joined by Secretary of State Hillary Rodham Clinton.

Obama, who ordered an increase in security at U.S. facilities overseas, said he “condemns in the strongest possible terms the outrageous and shocking” attack.

He spoke after Republican presidential challenger Mitt Romney condemned the attack, and criticized the administration for its initial response to a separate incident on Tuesday, the breach of the U.S. embassy in Cairo.

“I also believe the administration was wrong to stand by a statement sympathizing with those who had breached our embassy in Egypt instead of condemning their actions,” Romney told a morning news conference. “It’s never too early for the United States government to condemn attacks on Americans and to defend our values.”

Obama told CBS’ “Minutes” that Romney “seems to have a tendency to shoot first and aim later.”

Obama and Clinton made a rare joint visit to the State Department, where grieving colleagues of Stevens and the other three Americans killed in Benghazi gathered in a courtyard. The president also ordered U.S. flags to be flown at half-staff at government and military buildings and vessels around the world until sunset on Sept. 16. Flags had already been lowered in many places to commemorate the victims of the 9/11 attacks.

Clinton denounced those who might kill over an insulting movie.

“There is no justification for this,” Clinton said. “None. Violence like this is no way to honor religion or faith and as long as there are those who would take innocent life in the name of God, the world will never know a true and lasting peace.”

Underscoring the administration’s frustration, Clinton wondered aloud about the attack in Benghazi, which Gadhafi had once threatened to destroy.

“This is not easy,” she said. “Today, many Americans are asking, indeed I asked myself, how could this happen? How could this happen in a country we helped liberate, in a city we helped save from destruction? This question reflects just how complicated and, at times, just how confounding, the world can be.”

“But we must be clear-eyed in our grief,” she said, saying the attack was carried out by a “small and savage group” not representative of the Libyan people. She noted that Libyan security guards had tried to fight off the attackers, had carried Stevens’ body to the hospital and led other consulate employees to safety.

Ambassador Chris Stevens, 52, 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 with guns and rocket propelled grenades. Three other Americans were also killed.

Stevens is the first U.S. ambassador to be killed in an attack since 1979, when Ambassador Adolph Dubs was killed in Afghanistan.

The State Department identified one of the other Americans killed Tuesday as Sean Smith, a foreign service information management officer. The identities of the others were being withheld pending notification of next of kin.

In a statement earlier on Wednesday, Obama said the values of the four American’s killed “stand in stark contrast to those who callously took their lives.”

“They exemplified America’s commitment to freedom, justice, and partnership with nations and people around the globe,” he said.

In an allusion to the film that supposedly sparked violent protests in both Benghazi and Cairo, Egypt, the president said that while the United States “rejects efforts to denigrate the religious beliefs of others, we must all unequivocally oppose… senseless violence.”

Israeli President Shimon Peres sent a condolence letter to Obama condemning the attacks and expressing sorrow on behalf of all of Israel.

“Ambassador Stevens and his embassy staff represented the United States with much respect and acted in its name until the last moment, to advance the values of freedom and democracy,” Peres wrote. “Their devotion to these values served to strengthen Israel’s appreciation for the commitment of the US to advance peace and security worldwide.”

Prime Minister Benjamin Netanyahu also sent condolences, saying Israel understood the US’s loss.

“If there’s one country that understands what the Americans went through on September 11, it’s Israel, which has stood at the forefront of the battle against terror, which has lost many dear people and which identifies deeply with the American people at this hour,” he said in a statement.

Obama praised Stevens as “a courageous and exemplary representative of the United States,” and asserted that “his legacy will endure wherever human beings reach for liberty and justice.”

The president said he was “deeply saddened by this loss.”

Libya’s interim president apologized to the United States for the attack.

Mohammed el-Megarif described the attack as “cowardly” and offered his condolences.

“We extend our apology to America, the American people and the whole world,” el-Megarif said.

Stevens died as he and a group of embassy employees went to the consulate to try to evacuate staff when the mob of protesters, including gunmen armed with machine guns and rocket-propelled grenade, attacked.

The crowd, which numbered several thousand strong, moved on the consulate Tuesday evening, firing in the air outside the compound. The consulate is a one-story villa located in a fenced garden in downtown Benghazi. A small contingent of Libyan security forces protecting the facility also fired in the air, trying to intimidate them, said Wanis el-Sharef, the deputy interior minister of Libya’s eastern region.

But faced with the mob’s superior size and firepower, the Libyan security withdrew, el-Sharef said. Gunmen stormed the building, looted its contents and torched it, he said.

By the end of the assault, much of the building was burned out and trashed.

Details of how the Americans were killed were still being pieced together Wednesday. But according to al-Sharef’s account, two distinct attacks took place.

Al-Sharef said Stevens and a consultate staffer who had stayed behind in the building were killed in the initial attack on the consulate.

The rest of the staff successfully evacuated to another building nearby, preparing to move to Benghazi Airport after daybreak to fly to the capital, Tripoli, he said.

Hours after the storming of the consulate, a separate group of gunmen attacked the other building, opening fire on the more than 30 Americans and Libyans inside. Two more Americans were killed and 32 wounded – 14 Americans and 18 Libyans, he said.

Stevens, he added, was visiting Benghazi to inaugurate an American culture center in the city. His body was identified by his Egyptian interpreter. There was no immediate confirmation of al-Sharef’s account.

Stevens died of severe asphyxiation from smoke inhalation, according to the Libyan doctor who tried for 90 minutes to save him.

Ziad Abu Zeid told The Associated Press on Wednesday that Stevens was brought to the Benghazi Medical Center by Libyans the night before, with no other Americans and that initially no one realized he was the ambassador.

Abu Zeid said Stevens’ severe asphyxia caused stomach bleeding, but he had no other injuries.

Stevens was practically dead when he arrived close to 1 a.m. on Wednesday, but “we tried to revive him for an hour and a half but with no success,” Abu Zeid said.

Stevens was a career member of the US Foreign Service specializing in the Middle East, and served at various diplomatic posts around the region, including a stint as political section chief at the US consulate in Jerusalem.

He served as deputy chief of mission at the US Libyan embassy from 2007-2009, as part of the team that re-established US-Libyan official relations after a decades-long hiatus. During the Libyan civil war, he was the US representative to the Libyan Transitional National Council, and assumed his post as ambassador on May 22, 2012.

Earlier Tuesday night, violent protesters stormed the US Embassy in Cairo, Egypt, scaling the walls of the compound and replacing an American flag with an Islamic banner.

The protests in both Libya and Egypt were sparked by outrage over a film ridiculing the prophet Muhammad, produced by an Israeli filmmaker living in California and being promoted by an extreme anti-Muslim Egyptian Christian campaigner in the United States.

A 14-minute trailer of the movie that sparked the protests, posted on the website YouTube in an original English version and another dubbed into Egyptian Arabic, depicts Muhammad as a fraud, a womanizer and a madman in an overtly ridiculing way, showing him having sex and calling for massacres.

These were the first such assaults on US diplomatic facilities in either country, at a time when both Libya and Egypt are struggling to overcome the turmoil following the ouster of their longtime leaders, Muammar Gadhafi and Hosni Mubarak, in uprisings last year.

Sam Bacile, the writer, director and producer of the movie, which he says showcases his view of Islam as a hateful religion, was funded by $5 million from about 100 Jewish donors whom he declined to identify, The Wall Street Journal reported Tuesday.

AP contributed to this report.