The president of Libya's parliament, Mohamed al-Magariaf, has said military action is being considered against militants blamed for the killing of the US ambassador Chris Stevens.

Magariaf also confirmed reports from Washington that US officials intercepted communications discussing the planned attack on the US consulate in Benghazi, which he said linked al-Qaida in the Maghreb to an Islamist brigade, Ansar al-Sharia. "Yes, that happened," he said.

Magariaf said the intercepts matched other evidence indicating members of the brigade took part in Tuesday's all-night assault on the compound and an accommodation site. "It seems there is a division within Ansar al-Sharia about this attack, some for participation, some against," he said. "We are in the process of investigation."

Such transmissions would be powerful evidence linking al-Sharia to the attack, and Magariaf said Libya had been passed the information by the US government. He confirmed that the intercepted communications discussed the timing of last week's assault. But he urged the US not to act unilaterally, fearing it would antagonise public opinion. "We will not hesitate to act, to do what is our duty," Magariaf said. "Let us start first by ourselves and if we are not capable, then whoever can help us. My experience with the Americans, they know what they have to do."

His comments came as Libya's interior ministry said weekend raids had led to the arrest of 50 suspects, but gave no details and did not say whether they were Islamist militants.

Tension is building in Benghazi amid speculation that military action is imminent against the al-Sharia brigade, whose commanders deny responsibility for the consulate attack.

Magariaf claimed the attack had been premeditated. "It was planned, definitely. It was planned by foreigners, by people who entered the country a few months ago," he said. "And they were planning this criminal act since their arrival."

However, the US ambassador to the UN, Susan Rice, said on Sunday that the consulate attack was a spontaneous reaction to an anti-Muslim film, and not a planned or co-ordinated strike. She said it appeared to be a copycat demonstration inspired by those that had erupted hours earlier outside the US embassy in Cairo.

"It seems to have been hijacked, let us say, by some individual clusters of extremists who came with heavier weapons," Rice said, adding that whether those extremists had ties to al-Qaida or other terrorist groups has yet to be determined.

Two US warships equipped with Tomahawk cruise missiles are stationed off the coast and a propeller-driven aircraft with no lights, thought to be a drone, has spent hours in the skies above the city for the past two nights.

The Pentagon has dispatched elite marine rapid response teams to Libya and Yemen, but a team deployed to Khartoum on Friday was turned back when the Sudanese government objected.

The US defence secretary, Leon Panetta, said on Sunday the Pentagon had "deployed our forces to a number of areas in the region to be prepared to respond to any requests that we receive to be able to protect our personnel and our American property".

The al-Sharia brigade remains in its base in Benghazi, and its soldiers are guarding a hospital where medical officials say two wounded militants are being treated. Al-Sharia guards there refused to allow access or comment on the attack.

Magariaf said the attack on the US mission, the fifth on diplomatic targets in Benghazi since April, was part of a wider campaign by militants to destabilise Libya, taking advantage of the disorder of a country still without cohesive government.

"This is a turning point for the country. The confrontation is necessary and inevitable with these elements," he said. "[It is] either them or Libya being safe and united. Today it is the Americans, tomorrow it is going to be Libyans."

Magariaf rose to prominence in the 1980s when, having fled to Britain, he led the anti-Gaddafi National Front for the Salvation of Libya. He won a seat in the new parliament in July in an election in which tribal and liberal parties prevailed against the Muslim Brotherhood.

He said he had evidence "foreign countries" were involved in supporting the attack on the consulate but declined to name them. "It's a deliberate, calculated action by a group working in collaboration with non-Libyan extremists. I would not be surprised if it's another country, but it's not Saudi Arabia or Qatar, I'm sure."

In Benghazi, evidence linking members of the al-Sharia brigade to the attack is growing. The chief of the city's supreme security council said witnesses and mobile phone footage showed members were involved.

This was confirmed by an eyewitness who was among bystanders who turned up to see what began as an anti-US protest on Tuesday night.

The witness, who said he was too frightened to give his name, said he had watched as about a dozen armed men with a black al-Sharia brigade banner attacked the rear gate of the consulate with machine guns and rocket-propelled grenades.

"The guys were with beards and Kalashnikovs, they were standing there with the Ansar al-Sharia flag. One hundred per cent this was planned, they attacked from both sides [of the consulate] at once," he said.

A Libyan intelligence official told the Guardian at the weekend that a group of between 12 and 14 militants were suspected of orchestrating the attack.

Magariaf said he had held weekend meetings with both the army chief of staff, Yusef Mangoush, and what he called "loyal" brigades from the Libya Shield, in effect a parallel army of former rebel formations who distrust the present government, which the new parliament has yet to replace.

He also said he had the support of the new prime minister, Mustafa Abushagur, although a new cabinet has yet to be appointed and it is unclear whether the present administration, led by Abdurrahim al-Keib, which remains in power, has approved military action.

There are fears that while the Sharia brigade, which has an estimated 100 members, can be subdued, other jihadist groups in Libya, notably those which bulldozed Sufi Islamic shrines in Tripoli last month, may react if military action is taken in Benghazi.

Reactions to the anti-Islam video from around the world

• In Pakistan hundreds of protesters clashed with police as they tried to march toward the US consulate in Karachi. There were also protests in Lahore and Hyderabad in India.

• Canada announced that it was closing its embassies in Sudan, Libya and Egypt for the day as a precautionary measure.

• An Iranian religious foundation increased its reward by $500,000 for the killing of British author Salman Rushdie, saying his depiction of the Prophet Muhammad in his novel The Satanic Verses was blasphemous.

• Washington ordered family members and non-essential staff to leave its embassies in Khartoum and Tunis, and urged American citizens to leave Tunis.

• Hundreds of Muslims took to the streets of Sydney, throwing rocks and bottles in clashes with police.

• Police in Paris reinforced security around the US embassy as hundreds of people gathered to protest.

• Lebanon's Hezbollah Shia militant group will demonstrate in Beirut on Monday after its leader Hassan Nasrallah called on supporters to protest over the film.

Agencies