Tripoli: Libya apologised on Thursday to visiting US Deputy Secretary of State William Burns for an attack on the US consulate in Benghazi in which ambassador Christopher Stevens and three other Americans died.

Burns held talks in Tripoli with Libyan leaders including new Prime Minister Mustafa Abu Shagour and Mohammad Magarif, head of the national congress. He later attended a memorial ceremony for Stevens and his colleagues.

Foreign Minister Ashour Bin Khayyal apologised 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.

“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 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 US to do what Chris Stevens tried so hard to do. And that is to help Libyans realise 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 Abdul Rahim Al 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, Al 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 US government’s National Counterterrorism Centre, called the Benghazi assault a terrorist attack and said officials were looking at whether those involved had links to Al Qaida, particularly its North African affiliate, Al Qaida in the Islamic Maghreb.

The Libyan foreign ministry official said Burns and Bin Khayyal had discussed US involvement in the investigation, as well as broader security and economic cooperation.