The tendency to resort to the arms which ousted Muammar Gaddafi poses a roadblock to democracy in the new Libya, analysts warn, while recognising the government's growing capacity to defuse crises.
Libyan authorities resorted to force on Tuesday for the first time to repel dozens of armed men who had laid siege to Prime Minister Abdel Rahim al-Kib's offices to demand stipends and medical treatment for the war wounded.
"It is not just rogue elements but a pernicious logic that prevails across the country," Middle East specialist Karim Bitar told AFP, warning that Libya risks becoming swept by instability spreading across the Sahel region.
"The situation is very worrying," he said in reference to the latest attack on the government that left one dead and four people wounded.
Libya's new rulers face almost daily protests from armed ex-fighters who want financial and other benefits in recognition of their role in toppling the regime of slain leader Gaddafi in 2011.
The government has counted on dialogue with demonstrators, only to be cowed into signing checks by former rebels flaunting their firepower or blocking access to oil companies and institutions.
"The government will not be able to hold on for long if it keeps yielding to blackmail and buying the allegiance of militias with hard cash," Bitar said.
In televised remarks late Tuesday, Kib adopted a tough tone, vowing that his government would "not negotiate under the threat of arms" and warning of the use of force if necessary.
Tripoli High Security Committee head Khaled Besher said 14 assailants were arrested following the worst attack in Tripoli against Libya's new rulers.
How the government deals with militias, made up of former rebels who fought against Gaddafi's regime, could make or break Libya's transition to democracy, analysts say.
"People are not going to let go of their arms unless they feel that they are part of the political process," said an Arab pro-democracy activist in Tripoli, while warning that hurried elections could pave the way for more violence.
Strengthening state institutions, tackling rogue militias and dealing fairly with former supporters of Gaddafi's regime are steps the interim authorities must take to bring about normalisation, he said.
"With all the problems, the Libyan leadership has succeeded to a large extent in defusing the tensions," said the activist, asking not to be named.
Peter Cole of the International Crisis Group praises the government's handling of the latest crisis, noting the security forces used to intervene had been handpicked by the interior ministry.
But the bigger challenge remains in the national army and the defence ministry, which bloc-registered entire brigades without effectively bringing them under their command.
"By itself, the government and army doesn't have the capacity to secure the country for elections," said Cole, adding that individual disputes are likely to erupt during a vote.
"But the High Election Commission does have the ability to reach out to local authorities to manage security ... And there is no indication that, on the whole, militia groups have a desire to derail elections," he said.
Jason Pack, a researcher at Cambridge University and president of Libya-Analysis.com, sees it as "unlikely that the national army and security forces can be rapidly established to secure" a vote.
Libyans are due to elect a constituent assembly next month in what marks the first national vote after four decades of dictatorship.
The slogan "freedom does not mean anarchy" has become a mantra on the lips of interim government officials struggling to deal with periodic communal conflicts and violent outbursts by former rebels demanding benefits.
Lamia Abusedra, a founder of the Benghazi-based Forum For a Democratic Libya, said her group is working to spread a culture of dialogue and remains optimistic.
"We lived under dictatorship for 42 years but everyone agrees that they want democracy," she said, downplaying the insecurity as the result of a lack of experience in dialogue as well as the abundance of arms.