Deep in Libya’s southern Sahara, men in army uniforms guard a pipeline at the El Sharara oilfield. Hundreds of kilometres to the north, rival fighters turn off the pumps to stop the oil flowing.

The standoff over El Sharara illustrates the complex challenge United Nations mediators face in holding together a country heading towards a civil war between factions allied with rival cities scrambling for control.

UN envoys have been planning to bring the Libyan rivals together for a dialogue today, but the conflict is spreading with both sides increasingly at odds over the Opec country’s vast oil resources.

Since the 2011 revolution that toppled Muammar Gaddafi, Libya has enjoyed little stability. But rivalries worsened after a group called Libya Dawn seized Tripoli in August, setting up its own government and forcing the recognised Prime Minister, Abdullah al-Thinni, to flee to the east.

At El Sharara, one of the country’s largest fields, guards securing its storage areas, pumps and pipes are led by officers from Misurata, a coastal city 1,000km to the north and power base of Libya Dawn.

“We have been appointed by the chief of staff,” said oil force commander Mohamed Esmaida, referring to the Tripoli-based rival army leadership challenging Thinni’s own chief of staff.

He took over the field with around 400 guards driving Toyota pick-ups, a month ago after rivals from Zintan, a western region, withdrew. His men wear uniforms with “Libyan army” tags – like many Zintan fighters.

Conflict is complicated by rivalries between tribes, former Gaddafi units and staunchly anti-Gaddafi adversaries

The Zintanis, allied to Thinni, had already pulled out of the capital after a battle with Libya Dawn over the summer.

Now to make sure their rivals don’t benefit from the oil they have closed an El Sharara pipe valve crossing their territory. Just 70km west of El Sharara, co-owned by Spain’s Repsol, lies another oilfield called El Feel run by Italy’s ENI, which the self-declared Tripoli government has also been trying to restart but whose pipelines also cross Zintan territory.

Libya’s conflict is broadly pitting communities from coastal cities such as Misurata against tribes in the hinterland.

Both sides fought together to topple Gaddafi in 2011, but have since fought each other for control of the country. That inter-regional conflict is further complicated by rivalries between tribes, tensions between former Gaddafi units and staunchly anti-Gaddafi adversaries, and by infighting between Islamist-leaning and nationalist forces.

Each side is also trying to win recognition from neighbours such as Egypt, Algeria and regional powers in the Middle East.

Thinni, who accuses Libya Dawn of relying on Islamist militants, has teamed up with former Gaddafi army general Khalifa Haftar, who enjoys the support of tribes in the east and in Zintan.

The UN talks have so far focused on convincing the new Tripoli rulers to accept the legitimacy of the House of Representatives, the elected assembly working out of a remote city in east.

But this approach has come under pressure as the rival government has sought to consolidate power by taking over Tripoli ministries and oil facilities. Thinni has also drawn UN condemnation for launching air strikes on western Libya.

The UN Has not released any details on today’s talks after launching an initial round in the southern city of Ghadames in September. The first round invited members of the House of Representatives and lawmakers from Misrata who have boycotted the assembly but not any armed groups. UN Special envoy Bernadino Leon was expected in Tripoli early today.

A big challenge for mediators is that each side only controls parts of the vast nation, leaving large areas where few take orders from anyone. Clashes between rival tribes have made the roads from El Sharara to the nearby cities of Ubari and Sabha too dangerous to bring in food. An air force base around 200km away, controlled by Libya Dawn, supplies the field.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.