Opposing factions in Libya's civil war have agreed to terms for the formation of a unity government but negotiations have been marred by the abstention of the country's rival Tripoli administration which walked out of talks on 8 July.

The initialling of Libya's fifth peace agreement by a wide range of parties engaged in the conflict has been welcomed by the international community.

However, how the agreement will play out without the consent of Libya's Islamist government in Tripoli remains unclear.

Bernardino Leon
The UN\'s Bernardino Leon said the agreement was \'an important step for Libya\' FADEL SENNA/AFP/Getty Images

The Tripoli administration, which has the backing of a powerful coalition of militias known as Libya Dawn, has said it will not accept the peace terms unless its authority is recognised. The Tripoli government has also drawn red lines over the inclusion of General Khalifa Haftar, a former Gaddafi associate, in any political compromise.

Haftar, a divisive figure, now serves as the head of Libya's armed forces under the country's internationally recognised Baida government.

UN officials have heralded the peace talks as the last chance for Libya not to slide into an ever-deeper and more disastrous civil war. The UN's special representative to Libya, Bernardino Leon , said the agreement was "an important step in the road of peace in Libya".

He added, however, that "doors will remain open for those who have chosen not to be here," a reference to the four representatives Tripoli's General National Congress not present at the signing.

British foreign minister Philip Hammond welcomed the progress made in discussions and called on Tripoli to return to the negotiating table. "I call on the General National Congres to join the agreement and play a vital role in shaping a new constitution and parliament for Libya," he said in a statement.

The UN secretary-general Ban Ki Moon and the EU representative for foreign affairs Federica Mogherini have also both issued statements praising the progress in Libya.

Libya has been locked in a bitter power struggle between an Islamist government in Tripoli and its internationally recognised government in Baida since August last year when Libya Dawn militias seized control of the nation's capital.

Zintan Clashes
A fighter from Zintan brigade watches the aftermath of a militia strike an oil depot during the Libya Dawn takeover of Tripoli Hani Amara/Reuters

The ensuing, fractious civil conflict of shifting regional alliances has engulfed Libya in anarchy.

The chaos has been fertile ground for the offshoot of Islamic State in Libya which up until recently held strongholds in two major Libyan towns.

The presence of IS in Libya has become increasingly concerning to the international community. Following ostentatious displays of violence in Libya itself, it subsequently emerged that perpetrators of the Bardo Museum attack in Tunis and Seifeddine Rezgui, who killed 38 people in Port Sousse, had received training at IS and Ansar Al-Sharia camps in Libya.

The reported presence of international terror figures such as Mokhtar Belmokhtar and Mohammed Emwazi, better known as Jihadi John, in Libya have increasingly marked the country as a safe-haven, out of the reach of intelligence gatherers and the security services.