Cairo: Pro-government Libyan forces, already reeling from the fall of the capital, are fighting to prevent Islamist militants from seizing the eastern city of Benghazi and splitting the North African country into three warring parts.

Three weeks after losing Tripoli to a different militia, the army now faces an offensive in Libya’s second-largest city from the Islamists of Ansar Al Sharia, which has overrun special forces bases and is attacking Benghazi airport.

Losing the port city would not only leave the government looking impotent and irrelevant. It would also increase the risk of the country crumbling into de facto autonomous regions: the militants demand Islamist rule, while other armed groups want greater powers for the eastern region they call by its ancient name of Cyrenaica.

Rebel factions that united in 2011 in an uprising to smash the 42-year-rule of autocrat Muammar Gaddafi have turned their guns on one another, plunging Libya into chaos as they fight for power, oil, and cash from the $47 billion state budget.

Instead of the stable democracy Western powers had hoped to help create by backing the rebel uprising, Libya might be heading towards civil war, inviting comparisons with strife-torn countries such as Somalia, Yemen or South Sudan.

The fall of Benghazi would allow the Islamists to attack pro-government bases to the east, potentially threatening Bayda — the seat of the constitutional assembly — and Tobruk, where the government and elected parliament are holed up after losing Tripoli to a militia from Misrata called Operation Dawn.

Radical Islamists already control the coastal town of Derna, located halfway between Benghazi and Tobruk.

The central government is now only running a rump state of less than a third of the country, said Mattia Toaldo, policy fellow at the European Council on Foreign Relations.

“Between Dawn and Ansar Al Sharia, they control a large portion that extends from Benghazi to the border with Tunisia,” he said.

The conflict risks drawing in regional powers such as Egypt, worried about Libya turning into a safe haven for radical Islamists.

Libya’s competing parts already treat each other like different entities — the new rulers in Tripoli have set up a rival parliament and government, while seizing at least four ministries and state television.

There are almost no flights any more connecting western airports under Misrata control and eastern ones held by the government.

For their survival, the uprooted parliament and the army forces in Benghazi have allied themselves with retired general Khalifa Haftar, whom the government had previously accused of trying to stage a coup.

With the army and police existing mainly on paper, parliament needs Haftar, who commands air bases in the east, to confront Ansar Al Sharia and the Misrata-led armed factions. But his firepower has not stopped an Islamist advance in Benghazi.

Analysts say even more worrying for the government are signs of tentative ties between its two main enemies, as Ansar Al Sharia has offered to cooperate with Operation Dawn. The Misrata-led force has not responded to the offer, but some of its supporters are backing the Islamists on social media.

Members of Ansar Al Sharia, blamed by Washington for an assault on the US consulate in Benghazi during which the US ambassador was killed in September 2012, have appeared in Tripoli since the Misrata victory, pictures on Facebook show.

Both the Misrata forces and some Islamist fighters in Benghazi frame themselves as revolutionary forces fighting what they call elements of the Gaddafi regime.

They point out that Haftar was a top Gaddafi general before falling out with the former strongman. And some fighters from a militia allied to him from the western region of Zintan used to be part of Gaddafi’s security forces.

“We need to get rid of the Gaddafi forces still in control,” said a commentator justifying the Tripoli assault, on a television station controlled by Misrata.

For their part, Haftar and the Zintanis see their battle as an attempt to prevent Libya falling into the hands of Islamists.

The United Nations is trying to bring the new Tripoli rulers and elected lawmakers to the negotiating table.

But Dirk Vandewalle, author of “A Modern History of Libya”, said any coalition between the Misrata and Islamist forces would

probably be tactical, aimed at getting rid of the government, as they did when united during the Gaddafi uprising.

“Virtually all cooperation we are now witnessing between certain groups of militias is essentially tactical and temporary,” he said.

That would increase the likelihood of Libya breaking up into fiefdoms run by competing factions — a Misrata-led one in the west, an Islamist-dominated east and a powerless rump government in the far-east.

Encouraged by the Tripoli takeover, other armed groups might emerge or split from the main armed groups, which would make it difficult to identify national leaders for any foreign-led mediation.

“I am not optimistic about any mediation efforts,” said a Western ambassador to Libya.