Abdullah al-Thinni, the prime minister of the UN-recognised government in Tobruk, has said he has survived an assassination attempt by gunmen who opened fire as he was leaving a parliamentary session.

The incident highlighted the unravelling of state authority in the North African country in which two governments and parliaments allied to armed factions are fighting for control four years after rebels overthrew Muammar Gaddafi.

Thinni has faced increasing criticism for running an ineffective rump state in the east since losing the capital Tripoli in the west to a rival faction that now controls ministries and key state bodies based there.

The prime minister told pan-Arab news channel al-Arabiya that after he left parliament in the town of Tobruk and drove off, gunmen in several cars followed his entourage and opened fire.

"We were surprised by a lot of bullets... Thank God, we managed to escape," Thinni said, adding that one bodyguard had been wounded.

He did not elaborate but his cabinet said in a statement the gunmen had been "paid criminals" who had previously tried storming parliament.

Parliament speaker Aqila Saleh had asked Thinni to leave the assembly for his safety after protesters opposed to his government gathered outside the naval base where the parliament meets, two politicians told the Reuters news agency.

A burning car could be seen outside the gated venue, politicians said.

The session resumed after the departure of Thinni who works out of Bayda, near Tobruk to the west.

Security vacuum

Thinni's government had originally planned to set up parliament in the main eastern city of Benghazi but relocated to Tobruk near the Egyptian border after Benghazi turned into a battleground between the government and armed groups.

Parliament initially opened in a Tobruk hotel but moved to the naval base after a suicide bomber detonated a car in front of the hotel in December.

The House of Representatives is being challenged by the legally installed government in Tripoli, known as the General National Congress (GNC), that was set up after a rival faction seized the capital in August.

The GNC had been the country's previous assembly whose mandate had ended with the election of the House of Representatives but was reinstated by the new Tripoli rulers as the country split into two administrations.

Armed groups have exploited a security vacuum as the two governments fight each other on several fronts without either side gaining the upper hand.

Source: Agencies