Al-Qaeda has said the death of its second-in-command, Abu Yahya al-Libi has been avenged by the killing of the US ambassador to Libya earlier this week.

Al-Libi was killed in June of this year in Pakistan.

A communique by al-Qaeda in the Arabian Peninsula based in Yemen came as Libya’s interim president Mohammed el-Megarif told a French news agency that foreign elements had been implicated in the attack on the US consulate in Benghazi on Tuesday.

Ambassador Chris Stevens and three other embassy staff died in the initial violent reaction to a film made in America that many Muslims believe severely insults the prophet Mohammad.

President Obama was there when the bodies arrived home.

In a TV address afterwards he said: “As we mourn their loss, we must also send a clear and resolute message to the world: those who attack our people will find no escape from justice. We will not waver in their pursuit. And we will never allow anyone to shake the resolve of the United States of America.”

Obama said Stevens died a hero in a country that he helped to save.

The president rejected any denigration of Islam, but said there was no excuse for attacking US embassies and consulates.