The attack on the US consulate in Benghazi was a planned terrorist attack, according to London-based thinktank Quilliam.

The thinktank, which opposes Islamist ideology, claimed that only a few peaceful protesters took part in the event to mark Muslim anger at the film Innocence of Muslims.

It said that as there were no other demonstrations in Libya over the film, the Benghazi protest was used as a cover for an attack on the US consulate in which the US ambassador to the country, Chris Stevens, and three other embassy staff members were killed.

"We at Quilliam believe the attack on the US consulate in Benghazi was a well-planned terrorist attack that would have occurred regardless of the demonstration to serve another purpose," the thinktank wrote on its website.

"According to information obtained by Quilliam - from foreign sources and from within Benghazi - we have reason to believe that the attack on the US consulate in Benghazi came to avenge the death of Abu Yaya al-Libi, al-Qaeda's second in command killed a few months ago."

US sources told CNN that the rocket assault on the consulate was planned and that the attackers used the protest outside the consulate as a diversion.

The sources did not specify whether the attackers instigated the protest or merely took advantage of it. They did not believe that Stevens was explicitly targeted.

Quilliam, which has strong ties to Libya, claimed that 20 militants prepared for a military assault in the wake of the attack. They also noted that rocket-propelled grenade launcher RPG7 was present.

"These are acts committed by uncontrollable jihadist groups," said Noman Benotman, president of Quiloliam.