'Without a new prime minister and cabinet, the now legendary indecisiveness of the government of prime minister Abdurrahim el-Keib will extend its lame-duck period for at least three weeks.' Photograph: AP

Libya's experiment in democracy has taken another unexpected turn. On the surface, the elections to the General National Congress (GNC) last July produced a surprising victory for the "liberal" National Forces Alliance (NFA) and a fairly resounding defeat for the Muslim Brotherhood's Justice and Construction party.

But when those political parties were unable to forge a national unity government, that picture changed. It became inevitable that locally elected independents, who form the majority of the Congress, would come to the fore.

On 12 September, the NFA saw its prime ministerial candidate, Mahmoud Jibril, defeated by two votes in favour of Mustafa Abushagur, the outgoing deputy prime minister.

Abushagur seemed to be a compromise candidate. He enjoyed a reputation as a good manager with moderate Islamist leanings but without party affiliation. All elements of the "anyone but Jibril" camp rallied around him: Cyrenaicans and Tripolitanians, Muslim Brothers and Misratans with loyalties to their homegrown militias. It seemed then that Abushagur was just the man to cobble together a coalition of Libya's many factions.

And yet, when he presented his first cabinet list, it featured unexpected members of the outgoing transitional government, lacked a single candidate from the NFA, contained unknown quantities for key posts including the oil ministry, … and furthermore, it was apparent that Abushagur's allies were favoured.

Libya has so many cities that harbour intense local sentiment and it is manifestly impossible to appease them all simultaneously. Yet protesters from Zawiya were not placated by such hard truths; they stormed the Congress building.

When the list was read out in Congress, the NFA members simply walked out. As a result, the Libyan government and Abushagur were disgraced. The authorities revealed that they did not yet have sufficient military capacity to provide adequate security for their own parliamentary offices, let alone for the complex process of disarming and demobilising the hundreds of militias. For his part, Abushagur had clearly miscalculated how his cabinet list would be received – suggesting that he was not the right man for the moment after all.

After Abushagur's list was voted down, he was allowed to present an emergency replacement cabinet list. This was swiftly defeated – triggering a successful no confidence vote against him and reopening the process of selecting a new prime minister.

Libya's already weak central authorities will now be left without a proper government for another few weeks, at exactly the time that they need to crack down on the militias and Islamist radicals who attacked the American mission in Benghazi, killing ambassador Chris Stevens.

Is this a case study in Libyan dysfunction or a testament to the depth of Libya's conversion to democratic practices? Only time will tell, but there are significant arguments to be made on both sides.

Any new Libyan prime minister would face the same nearly insurmountable challenges of putting together a cabinet that would satisfy a majority of Libyans while also having the technical and administrative skills to be effective.

How much of Abushagur's dismissal is due to a growing emphasis on regional power struggles rather than an actual lack of confidence in the man himself? If Libyan politicians cannot learn to compromise effectively, this deadlock will continue.

Political parties or regions demanding a certain number of ministers and then refusing to participate entirely in a government if their demands are not met is not conducive to running a country in crisis. It would lead to the warlordisation of Libya with the central authority controlling no more than a portion of the capital.

Without a new prime minister and cabinet, the now legendary indecisiveness of the government of prime minister Abdurrahim el-Keib will extend its lame-duck period for at least another three weeks. In fact, el-Keib has been largely absent from government proceedings since the selection of Abushagur as prime minister-elect – ironically leading to a situation where Abushagur, even though he was just deposed as prime minister, may effectively remain as head of government in his capacity as deputy prime minister of the outgoing government.

On the other hand, if GNC members voted with what they believe to be the best interest of their constituents, then we have just witnessed democracy in action. New realignments in parliament could allow for a unity government.

Already the NFA – which formed the largest single source of opposition to an Abushagur government – is fracturing, with one-time general secretary Faisal Krekshi leaving the NFA just days before to potentially become the health minister in Abushagur's first cabinet list.

It is rumoured that the NFA and the Justice and Construction party are in back-channel negotiations. If an agreement were to materialise – which would have been unthinkable a month ago – it could produce a solid unity government able to take the necessary bold decisions to crack down on the militias and renew major public infrastructure projects.

It must also be remembered that despite the cabinet crisis there is not a complete power vacuum in Libya. The democratically elected Congress is still in place and despite the terrorist attack on the American mission, Libyans have spontaneously united to denounce violence and rebuild their nation.

It is far too early to predict the demise of the Libyan democratic experiment.