A car bomb exploded outside the Swedish consulate in the restive Libyan city of Benghazi Friday, seriously damaging the building but causing no casualties, a security official said.

"A powerful explosion in front of the Swedish consulate caused serious damage to it and neighbouring buildings but no casualties," Colonel Abdullah Zaidi said.

The incident highlights the lawlessness in Libya since the 2011 uprising that ousted dictator Moamer Kadhafi, and comes just a day after former rebels took Prime Minister Ali Zeidan hostage in Tripoli and held him for several hours.

The Swedish mission is one of the few remaining diplomatic offices remaining in Benghazi, which was the cradle of uprising and frequently sees attacks on security personnel and institutions.

The consulate is in the Al-Fouihet district of the eastern city, not far from the Egyptian consulate which was bombed in August.

The worst attack was in September 2012, when armed men assaulted the US consulate, killing ambassador Chris Stevens and three other Americans.

Such attacks are routinely blamed on Islamists, but have never been claimed.

Neither has any group yet said it was behind the attack on the Swedish consulate.

Zeidan was kidnapped just days after US commandos embarrassed and angered the government by capturing senior Al-Qaeda suspect Abu Anas al-Libi on the streets of Tripoli and whisking him away to a warship in the Mediterranean.

That case has embarrassed the Libyan government and put it under pressure from its critics, notably former rebel groups in the 2011 revolt.

One such group, the Operations Cell of Libya's Revolutionaries, said earlier this week it was on high alert "in light of the deterioration in security and damage to the country's sovereignty by foreign intelligence bodies".

It ordered its fighters to be prepared for orders to "hunt down and expel foreigners who are illegally in the country".

It blamed Zeidan for Libi's capture and said it had "arrested" the premier on Thursday.

But later, the Brigade for the Fight against Crime, a police division made up of former rebels, said it was holding Zeidan.

The government said it suspected both groups of being behind the abduction.

The two groups loosely fall under the control of the defence and interior ministries but largely operate autonomously.

Two years after the revolution that toppled Kadhafi, Libya's new authorities are still struggling to rein in tribal militias and groups of former rebels.

Public anger in Libya is growing as widespread violence -- including assassinations -- proliferates, particularly in the east of the country.

Many Libyans blame political rivalries for the problems plaguing a country awash with militias and weaponry left over from the 2011 NATO-backed rebellion.