The US Consulate in Benghazi is seen in flames during a protest. .

A US counter-terrorism official has said the recent attack on the US consulate in Benghazi was a "terrorist attack" but was not pre-planned.

Matthew Olsen, director of the National Counterterrorism Center, told a Senate hearing that the embassy attack in Libya in which US ambassador Christopher Stevens and three other US officials were killed indicated the involvement of armed extremist groups.

"We are looking at indications that individuals involved in the attack may have had connections to al-Qaida or al-Qaida's affiliates, in particular, al-Qaida in the Islamic Maghreb," said Olsen.

Olsen said that although the extremists did not plan the attack, they took advantage of the violent protests against an anti-Islam film to move against American interests.

US investigators are looking at the possibility of any link with al-Qaida especially its North Africa affiliate, AQIM. The attackers used heavy weapons such as rocket-propelled grenades and mortars in the consulate attack, a scenario unlikely for any spontaneous protest.

"We do know that a number of militants in the area, as I mentioned, are well armed and maintain those arms. What we don't have at this point is specific intelligence that there was a significant advanced planning or coordination for this attack."

The information the Obama administration has given out so far is that the attack was the outcome of a protest against the US-made anti-Islam film, Innocence of Muslims.

White House spokesman Jay Carney also said the armed groups in the region hostile to the US and the West were taking advantage of the situation, the CNN reported.

"It is a fact that there are in post-revolution, post-war Libya armed groups, there are bad actors, hostile to the government, hostile to the West, hostile to the United States and as has been the case in other countries in the region, it is certainly conceivable that these groups take advantage of and exploit situations that develop when they develop to protest against or attack either westerners, Americans, western sites or American sites."

FBI investigators are expected to be in Benghazi before the weekend to collect evidence.