Five years after the start of the unrest that culminated in the ousting and killing of Muammar Gaddafi, Libya remains without a single government with authority over the whole country.

The elected and internationally-recognised government has only tenuous control over the eastern region of Cyrenaica where its fledgling, badly equipped and poorly trained army is battling jihadist militias in Libya's second city of Benghazi and other key towns.

Its authority is challenged by an Islamist-led administration installed by a parliament whose mandate has long run out but which is in control of the capital, Tripoli.

Some elements of the two rival groups have signed up to a United Nations-sponsored power-sharing deal but others remain opposed and peace remains elusive.

It is the militias operating across the country, thought to number nearly 2,000, who are really calling the shots.

Most recently, fighters from the so-called Islamic State (IS) have established a stronghold in the central coastal city of Sirte, and have advanced towards nearby oil sites in Sidra and Ras Lanuf, an attractive source of revenue for the militant group.

NON-JIHADIST GROUPS

Libya Dawn

Image copyrightGetty ImagesImage caption
The Libya Dawn militia was initially dominated by fighters from the city of Misrata

Libya Dawn is a grouping of pro-Islamist militias that in summer 2014 attacked Tripoli International Airport and went on to seize large parts of the capital.

The militia alliance can be viewed as the "armed forces" of the General National Congress (GNC), the former parliament which has been reconvened in Tripoli.

Libya Dawn, which has acquired military planes, controls virtually all coastal cities, from Misrata to the border with Tunisia as well as cities further south, including Gharyan, Nalut and Jadu in the mainly Berber mountain range of Nafusa.

The name Libya Dawn originally referred to the militias' operation to seize Tripoli but soon came to refer to the armed group coming under its umbrella.

Many of its fighters came from the city of Misrata, but in the last year the powerful militias based in that city appear to have drifted from the Libya Dawn coalition.

There appears to have been a rift within the militia over support for the UN-sponsored talks and the proposed Government of National Accord, which seeks to unite the rival governments.

Libya Shield

The Libya Shield grouping is made up of several militias of the same name that operate in various parts of the country.

The Central Libya Shield supports the defunct GNC and is viewed by the unrecognized Tripoli authorities as part of its "Ministry of Defence" forces. The Central Shield is further broken down into smaller groups. Its Third Force seized control of Birak al-Shati airport in central Libya, over 700km south of Tripoli.

The Shield's Benghazi branch (known as Libya Shield Force 1) is led by prominent Islamist commander Wisam Bin-Hamid, who has fought alongside the now deceased commander of the hardline al-Qaeda-linked Ansar al-Sharia group, Muhammad al-Zahawi.

Bin-Hamid is also a field commander in the Benghazi Revolutionaries Shura Council (see below).

Other pro-GNC groups

In addition to Libya Dawn, the GNC also relies on other armed groups that it deems to come under the control of its self-proclaimed "commander-in-chief", GNC Speaker Nuri Abu-Sahmain.

These include Battalion 166, which alongside Libya Dawn forces, has engaged in clashes with IS in and around Sirte.

The militias reportedly withdrew from Sirte ahead of IS's takeover of key swathes of the city in May 2015, prompting the internationally-recognised authorities in the east to accuse them of "collusion" with IS. For their part, supporters of the militias said they had not received enough support from the GNC to fight IS.

The GNC continues to maintain that the chief of staff when the congress was in power, Maj-Gen Jadallah al-Obaidi, continues to hold the post and head the "armed forces".

In recent months, the Libyan Petroleum Facilities Guard (PFG) has become more prominent due to regular clashes with IS militants.

The group's politics are unclear, although it may be described as a parastatal force that is broadly supportive of the GNC. It is led by Ibrahim al-Jadran who has condemned IS, although his brother is said to be an IS commander.

Early in 2016, the PFG distanced itself from the internationally-recognised government and launched a scathing attack on the commander of the Libyan National Army, saying that he and IS were "two sides of the same coin".

Libya's rival power bases (as of August 2015)

JIHADIST GROUPS

Islamic State (IS)

A major development on the ground in Libya in 2015 was the emergence of IS.

IS built on an existing presence in the eastern city of Derna, a long-time jihadist hub, where groups active pledged allegiance to IS and took over local administration buildings.

Although IS was driven out of most areas of Derna in July 2015 it went on to seize "complete control" of the central coastal city of Sirte, the birthplace of former leader Muammar Gaddafi. In June, the group's official radio station, al-Bayan, which is already operating in Syria and Iraq, reportedly began broadcasting from Sirte.

IS has claimed that it has captured the coastal town of Bin-Jawad, as well as having a "strong presence" in Nofilia, Sidra and Ra's Lanuf, putting it significantly closer to installations in Libya's oil rich region, and leading to repeated clashes with the Petroleum Facilities Guard (see above).

Image copyrightScreengrabImage caption
Islamic State first came to prominence in Derna

IS has managed to strike in Tripoli and Benghazi by launching high-profile one-off attacks, for example those targeting embassies and hotels in Tripoli in January and February 2015, and most recently on a police training base in Zliten, near the capital.

The group is also present in Benghazi and has cells in Tripoli.

IS has divided Libya geographically into three "provinces": Barqah (Cyrenaica) in the east, Tripoli (referring to wider Tripolitania) in the west, and Fezzan in the centre and south.

According to a UN report issued in December, IS has between 2,000 and 3,000 fighters in Libya, including 1,500 in Sirte. The group seems to be attracting fighters from sub-Saharan countries.

The main armed militias in the fight against IS in the city are the Derna Mujahidin Shura Council and the Abu-Salim Martyrs Brigade, which are known for their ties to Ansar al-Sharia (see below).

Ansar al-Sharia

Al-Qaeda's Libyan affiliate, Ansar al-Sharia, is most prominent in eastern Libya. In Benghazi, its militants have been present since the overthrow of Gaddafi in 2011 and have been continuously battling the Libyan National Army (LNA) of the internationally recognized government based in Tobruk (see below).

The group also has a presence in Derna and Sabratha in the west.

The militia has been accused of involvement in the attack on the US consulate in September 2012 in which Ambassador Chris Stevens was killed and is listed by the United States as a terrorist organisation.

It uses its Twitter account, which is routinely suspended and reopened, to advertise its attacks on army forces.

Image copyrightAFPImage caption
Some former rebels have been integrated into the army

Benghazi Revolutionaries Shura Council

A coalition of Islamist militias, the Benghazi Revolutionaries Shura Council is made up of groups including Ansar al-Sharia, the 17 February Brigade and the Rafallah al-Sahati Brigade.

As with its key component Ansar al-Sharia, the Benghazi Shura Council is another firm opponent of the LNA. It maintains strongholds in parts of the eastern city that army forces have struggled to seize.

IS has criticized the Benghazi Shura Council for not pledging allegiance to the group, accusing it of being loyal to Libya Dawn and the "forces of democracy". IS has cited these as evidence of the council's "apostasy".

Derna Mujahidin Shura Council

Another al-Qaeda-affiliated group, the Derna Mujahidin Shura Council, is a coalition of Islamist militias formed in December 2014.

It came into the spotlight particularly in July 2015, after driving IS militants out of most areas of Derna.

Clashes between the two groups escalated significantly after IS killed two Islamist figures linked to the Derna Mujahidin Shura Council.

Ajdabiya Revolutionaries Shura Council

The Ajdabiya Revolutionaries Shura Council is an Islamist militant group based in Ajdabiya, a coastal town west of Benghazi and is led by Muhammad al-Zawi.

Twice in January the IS-linked "news agency" A'maq reported that al-Zawi and a number of his men had pledged allegiance to IS.

The council issued a statement, dated 2 January, saying it had nothing to do with the matter and the pledge represented an individual acts.

The militia has been engaged mainly in fighting the LNA.

PRO-GOVERNMENT GROUPS

Armed forces and allied units

Image copyrightReutersImage caption
Khalifa Haftar returned from the US to help topple Gaddafi

On the side of the internationally-recognised authorities are various forces comprising the Libyan National Army (LNA) and units supporting it.

Maj-Gen Khalifah Haftar, who in May 2014 launched Operation Dignity against Islamist groups, and had largely operated alongside but outside the military's official ranks, was appointed army commander by the House of Representatives in March 2015.

The LNA is supported by various units, including militias (see below) and the Special Forces, al-Saiqa, which declared their support for Gen Haftar at the time of his announcement of Operation Dignity. Along with the government forces' Tanks Battalion, the al-Saiqa forces have been particularly targeted by Islamist militia attacks.

Zintan, al-Sawaiq, al-Qaqa Battalions

The Zintan, al-Sawaiq and al-Qaqa brigades are anti-Islamist militias that operate especially in the west of Libya.

The powerful Zintan militia supports the internationally-recognised authorities and has clashed on numerous occasions with Libya Dawn. It continues to detain Saif-al-Islam al-Gaddafi, the son of the former leader who was sentenced to death in Tripoli last year, in the western city of Zintan, while most other Gaddafi-era officials are held by pro-Islamist forces in Tripoli.

The al-Qaqa and al-Sawaiq battalions are also pro-official authorities and anti-Islamist. They attacked the GNC in Tripoli soon after Operation Dignity was announced in May 2014.

BBC Monitoring reports and analyses news from TV, radio, web and print media around the world. For more reports from BBC Monitoring, click here