By Marie-Louise Gumuchian and Ali Shuaib
TRIPOLI (Reuters) - Libya apologized on Thursday to visiting U.S. Deputy Secretary of State William Burns for an attack on the U.S. consulate in Benghazi in which U.S. ambassador Christopher Stevens and three other Americans died.
Burns held talks in Tripoli with Libyan leaders including new Prime Minister Mustafa Abu Shagour and Mohammed Magarief, head of the national congress. He later attended a memorial ceremony for Stevens and his colleagues.
Foreign Minister Ashour Bin Khayyal apologized to Burns for the violence on Tripoli's behalf, praising Stevens as a "friend of Libya", a foreign ministry official said after their meeting.
The four Americans died when gunmen attacked the consulate and a safe house in the eastern city of Benghazi. The attackers were among a crowd protesting against a video made in California that mocks Islam and the Prophet Mohammad.
"We do agree, Libyans and Americans that it is absolutely essential and urgent to bring those responsible for this horrible tragedy to justice just as quickly as possible and we're determined to work together to ensure that that happens," Burns told reporters.
"This is a shared loss, a terrible tragedy," he added. "But it is also a reminder of the importance of renewing the determination of the U.S. to do what Chris Stevens tried so hard to do. And that is to help Libyans realize the premise of the revolution, not allow it to be hijacked by extremists."
Burns later paid tribute to Stevens as "a wonderful ambassador (who) believed in Libya".
After meeting Burns, outgoing Prime Minister Abdurrahim El-Keib said the killing of Stevens was "definitely not representative of the moral values that we have here in Libya".
He also said the video was "distasteful" and "does not reflect the feeling of the American people".
At the early evening memorial for Stevens and his colleagues, Keib said the attackers were "a group of outlaws (who) must be brought to justice".
In Washington, a State Department spokeswoman said Burns urged Libyan officials to "build the kind of security institutions that are going to ensure the safety of the Libyan people, diplomats serving there, and foster a democratic environment, economic progress that protects the freedoms and the rights of all Libyans.
"We will not allow our partnership with Libya to be weakened by extremists," she said.
Matthew Olsen, director of the U.S. government's National Counterterrorism Center, called the Benghazi assault a terrorist attack and said officials were looking at whether those involved had links to al Qaeda, particularly its North African affiliate, al Qaeda in the Islamic Maghreb.
The Libyan foreign ministry official said Burns and Bin Khayyal had discussed U.S. involvement in the investigation, as well as broader security and economic cooperation.
Magarief, who apologized last week "to the United States, the people and the whole world" for the Benghazi attack, agreed in a telephone call with U.S. President Barack Obama that their countries would work together to investigate it.
"These events strengthen the determination of the authorities to arrest and bring to justice those responsible and reinforce the security of diplomatic missions," Magarief said at the memorial ceremony.
Libya sacked its security chiefs for Benghazi after the attack. Another official, tasked with employing militia fighters in the police in the east of the country, said he had resigned because recruits were not being paid or supplied adequately.
Libya's interim government has struggled to impose its authority on a myriad armed groups that have refused to lay down their weapons since last year's overthrow of Muammar Gaddafi. The fighters often take the law into their own hands.
(Additional reporting by Washington bureau; Editing by Andrew Roche)
Poll: Only 4% of U.S. Adults are Newly Insured, Half Choose Obamacare Alternative | Sarah Jean Seman