Libyan delegates at UN-sponsored talks in Geneva have elected a new interim government tasked with leading the war-torn country to elections in December.

Friday’s move is a step towards unifying the oil-exporting state, which has been divided between warring administrations in the east and west since 2014 while militias hold sway on the ground in many parts of the country.

The government, which is intended to replace these two administrations, will be led by Mohammed al-Menfi, a diplomat, with a support base in eastern Libya who was chosen as head of a three-member presidency council. Abdul Hamid Debeibeh, a businessman and politician from the city of Misurata in western Libya will serve as prime minister. The government list headed by Menfi won a surprise victory against heavyweight politicians and security chiefs with influential constituencies in both eastern and western Libya.

Stephanie Williams, the UN acting envoy, described the election as a “ historic moment” after the result was announced. She said: “You overcame your differences, the divisions and the many challenges you faced in this fruitful but difficult journey in the interests of your country and the Libyan people.”

The interim government’s main job will be to oversee preparations for parliamentary and presidential elections to be held on December 24. Its members have to commit to not seek power themselves or stand as candidates. The election is part of peacemaking efforts and follows a ceasefire agreement in October brokered by the UN after the failure of a fourteen-month offensive led by General Khalifa Haftar, the eastern strongman, aimed at seizing Tripoli, the capital in the west of the country.

But the ceasefire remains uneasy, and it is not certain that the new government will be able to cement it, disarm militias and stave-off intervention from foreign powers which arm and support the two sides.

“This isn’t a government that is a product of a national reconciliation process,” said Tim Eaton, Libya analyst at Chatham House, the London-based think-tank. “It has come out of political dealmaking or a power-sharing agreement, and many elements of conflict are still there.”

He argued that its mandate “is not that strong” because it was chosen by 39 out of 75 participants in a political dialogue process hosted by the UN.” Also, we will still have to see how external political powers react to it,” he said. He said the interim government team did not appear to have a clear political vision or programme and would have to engage in dealmaking with various power groups. “I think there are a lot of powerful factions that seem to be locked out of this,” he sad. “We will have to see how they will try to broaden their alliances.”

The conflict in Libya between Haftar and his eastern allies against the current UN-backed government in Tripoli, which is backed by groups of western militias, had morphed into a proxy war drawing in foreign countries. The government in Tripoli has been backed and armed by Turkey, while Haftar has been supported by the United Arab Emirates, Russia and Egypt. Foreign backers on both sides have provided their clients with foreign militias to bolster their ranks.