WHEN Fayez al-Serraj returned to Libya in March the situation looked unusually hopeful. For two years, rival governments in the east and west of the country had fought over a disputed election. In December representatives from both sides of the country (but not their leaders) agreed to a UN-backed peace proposal. Powerful players in the war withheld their support, but they could be brought in later, said advocates. The deal, known as the Skhirat agreement after the Moroccan town in which it was signed, empowered Mr Serraj (pictured), then a relatively unknown politician, to form a government of national accord (GNA). His smooth arrival in Tripoli, the capital, in March seemed to herald a brighter future.

It has not turned out that way. The new government, though ostensibly backed by some powerful militias, has failed to gain broad support. The eastern parliament, called the House of Representatives (HOR), has refused to approve the body, as required under the Skhirat agreement. Remnants of the old government and legislature in the west, known as the General National Council (GNC), unsuccessfully attempted a coup in Tripoli last month.

Far from ending the Libyan conflict, the Skhirat deal has reconfigured it, says a new report from the International Crisis Group, a think-tank in Brussels. “A year ago, the conflict was between rival parliaments and their associated governments; today it is mainly between accord supporters and opponents, each with defectors from the original camps and heavily armed.”

Neither side is satisfied with the agreement, which left security questions unanswered. Indeed, the HOR’s position stems in large part from its fear that Khalifa Haftar, the commander of the Libyan National Army, the biggest armed group in the east, would be sidelined under the deal.

The conflict looks likely to escalate. In September Mr Haftar captured several oil facilities along the coast. Now a hodgepodge of militias, most of them Islamist, are readying to fight him there and in cities such as Derna and Benghazi.

The GNA’s defence ministry is said to be co-ordinating with the anti-Haftar forces, but most of the militias that support the government, many hailing from Misrata, do not plan to take part in the fight. They and others are still trying to push the jihadists of Islamic State (IS) out of Sirte, on the coast.

The outside world had hoped the battle against IS would encourage unity. But even western Libya remains divided. A number of the groups fighting IS do not recognise the GNA, which many Libyans see as beholden to the Misratans, or as a puppet of the UN. The support the GNA does receive is fickle and based mainly on self-interest. It has only a tenuous grip on its own capital, where armed groups operate without control. Some changed sides last month and participated in the attempted coup. Mr Serraj still holds his meetings at a heavily-guarded naval base, not the prime minister’s office.

Foreign countries, many of which pushed for the Skhirat agreement, have added to the discord. Libyans feel that the West, which supports the GNA, has neglected local concerns while fighting terrorists and trying to stem the flow of refugees across the Mediterranean Sea. Some in the West also appear to be working with Mr Haftar on these issues. The general receives weapons—and, perhaps, air support—from Egypt and the United Arab Emirates, and advice from Russia. His supporters hope Donald Trump, America’s president-elect, will also take their side, though he has not expressed much interest in Libya.

The GNA, for its part, has done little to win over the public. Services are sporadic at best, while the economy is teetering. Under Mr Haftar, at least, more oil is flowing from the facilities along the coast, with revenues going to the central bank. But the government has feuded with the bank over funding and economic policy (there is none, says Saddek al-Kabir, the head of the bank). Under Western pressure, the government has promised to publish an economic plan by December 1st, and the bank will give $6bn to the government.

Mr Haftar’s fate is perhaps the biggest question hanging over Libya. Popular in the east and parts of the west, he may seek to follow the path of Abdel-Fattah al-Sisi, who crushed Egypt’s Islamists as head of the army and then shed his uniform to run for president. Many supporters of the Skhirat agreement are convinced that Mr Haftar will never compromise or lay down his arms. But they still think it best to push on with the imperfect deal in hand.

After five years of upheaval, most Libyans want the fighting to stop. The ICG and others have called for new talks, this time involving people, such as Mr Haftar, who can actually influence events on the ground. The West, though, is being stubborn. “The UN and international community continue to insist [the Skhirat agreement] is the only option, when everyone realises this is not going to work,” says Mohamed Eljarh of the Atlantic Council, a think-tank in Washington. “There is a lack of creativity in terms of solutions.”