A damaged aircraft is pictured after shelling at Tripoli International Airport August 24, 2014. Unidentified war planes attacked targets in Libya's capital Tripoli on Sunday, residents said, hours after forces from the city of Misrata said they had seized the main airport. Tripoli residents heard jets followed by explosions at dawn but no more details were immediately available. Image Credit: REUTERS

Tripoli: “The fire is inside the airport!” a militiaman cried, as he fired an anti-aircraft cannon on the back of a pickup truck toward the runway of Libya’s main international airport. “God is great, the flames are rising!”

“Intensify the shooting,” responded his commander, Salah Badi, an ultraconservative Islamist and former lawmaker from the coastal city of Misrata.

Captured on video by the proud attackers just one month ago, Badi’s assault on Libya’s main international airport has now drawn the country’s fractious militias, tribes and towns into a single national conflagration that threatens to become a prolonged civil war. Both sides see the fight as part of a larger regional struggle, fraught with the risks of a return to repressive authoritarianism or a slide toward Islamist extremism. Three years after the Nato-backed ouster of Muammar Gaddafi, the violence threatens to turn Libya into a pocket of chaos destabilising North Africa for years to come.

Libya is a haven for itinerant militants, and the conflict has opened new opportunities for Ansar Al Sharia, the hard-line Islamist group involved in the assault on the US diplomatic mission in Benghazi in 2012.

Those backing Badi say his attack was a pre-emptive blow against an imminent counterrevolution modelled on the military takeover in Egypt. Their opponents, including the militias stocked with former Gaddafi soldiers that controlled the airport, say Badi was merely the spearhead of a hard-line Islamist onslaught resembling the Islamic State and supported by the Islamist-friendly governments of Turkey and Qatar.

The ideological differences are blurry at best: both sides publicly profess a similar conservative but democratic vision. What is clear is that Libya is being torn apart by an escalating war among its patchwork of rival cities and tribes.

In a broad series of interviews on a five-day trip across the chasm now dividing the country — from the mountain town of Zintan, through Tripoli to the coastal city of Misrata — many Libyans despaired of any resolution.

“We entered this tunnel and we can’t find our way out,” said Ebrahim Omar, a Zintani leader.

Towns and tribes across the country are choosing sides, in places flying the flags of rival factions, sometimes including the black banners of Islamist extremists.

Tripoli, the capital and the main prize, has become a battleground. The fighting has destroyed the airport, and on Saturday night Badi’s allies finally captured the remaining rubble, at least for the moment. Constant shelling between rival militias has levelled blocks, emptied neighbourhoods and killed hundreds of people. Storage tanks holding about 25 million gallons of fuel have burned unchecked for a month. Jagged black clouds shadow the city, with daily blackouts sometimes lasting more than 12 hours.

Motorists wait in lines stretching more than three miles at shuttered petrol stations, waiting for them to open. Food prices are soaring, uncollected garbage is piling up in the streets and bicycles, once unheard of, are increasingly common.

In Benghazi, Libya’s second-largest city, the fighting has closed both its airport and seaport, strangling the city.

In an alarming turn for the West, the rush towards war is also lifting the fortunes of the Islamist extremists of Ansar Al Sharia, the Benghazi militant group. It has gained ground because other militias and factions are building new alliances with its fighters against common enemies.

The United Nations, the United States and the other Western powers have withdrawn their diplomats and closed their missions. “We cannot care more than you do,” the British ambassador, Michael Aron, wrote in a Twitter message to a Libyan pleading for international help.

Even the first years after Gaddafi’s ouster were better, said Hesham Krekshi, a former Tripoli councilman, savouring a few hours of uninterrupted electricity in the upscale cafe he owns, its tables and the street deserted. “This is a war, and a lot of innocent people are dying.”

Until now, a rough balance of power among local brigades had preserved a kind of equilibrium, if not stability. Although the transitional government scarcely existed outside of the luxury hotels where its officials gathered, no other force was strong enough to dominate. No single cleavage divided the competing cities and factions.

But that semblance of unity is in tatters, and with it the hope that non-violent negotiations might settle the competition for power and, implicitly, Libya’s oil.

In May, a renegade former general, Khalifa Haftar, declared that he would seize power by force to purge Libya of Islamists, beginning in Benghazi. He vowed to eradicate the hard-line Islamists of Ansar Al Sharia, blamed for a long series of bombings and assassinations.

Borrowing lines from President Abdul Fattah Al Sissi of Egypt, Haftar also pledged to close Parliament and arrest moderate Islamist members. And he has mustered a small fleet of helicopters and warplanes that have bombed rival bases around Benghazi, a steep escalation of the violence.

To fight back, moderate Islamists and other brigades who had distanced themselves from Ansar Al Sharia began closing ranks, welcoming the group into a newly formed council of “revolutionary” militias.

“A lot of them have fought well,” Ali Bozakouk, a moderate Islamist lawmaker from Benghazi, said of militants with Ansar Al Sharia, speaking last week after meetings in Misrata. “When you are fighting against an intruder, sometimes you have hard choices. You are brothers in arms now and work out your differences later.”

But the war has driven the other militias closer to the militants and further from moderates like Bozakouk.

Last week, a broad alliance of Benghazi militias that now includes Ansar Al Sharia issued a defiant statement denouncing relative moderates like the Libyan Muslim Brotherhood. “We will not accept the project of democracy, secular parties, nor the parties that falsely claim the Islamic cause,” the statement read. “They do not represent us.”

Although the general’s blitz has stalled, it polarised the country, drawing alarm from some cities and tribes but applause from others. Perhaps the loudest applause came from the western mountain town of Zintan, where local militia leaders had recruited hundreds of former Gaddafi soldiers into special brigades, while also keeping control of the Tripoli airport.

The alarms went off in the rival coastal city of Misrata, where militias have allied with the Islamists in political battles and jostled with the Zintanis for influence in the capital. Since Gaddafi’s ouster, the Misrata and Islamist militias developed a reputation for besieging government buildings and kidnapping high officials to try to pressure Parliament. But in recent months the Zintanis and their anti-Islamist allies have stormed the Parliament and kidnapped senior lawmakers as well.

Adding to the tensions, the newly elected Parliament, led at first, on a seniority basis, by a member supportive of Haftar, announced plans to convene in Tobruk, an eastern city under the general’s control.

About 30 members, most of them Islamists or Misratans, refused to attend, dispelling hopes that the new legislature might unify the country. “That is foreign territory to me,” said Bozakouk, the Benghazi representative, who joined the boycott. (Tripoli’s backup airport, under the control of an Islamist militia, has cut off flights to Tobruk, even blocking a trip by the prime minister.)

Over the weekend, a spokesman for the old disbanded Parliament, favoured by the Islamists and Misratans, declared that it would reconvene in Tripoli. In Tobruk, a spokesman for the new Parliament declared that the Islamist- and Misratan-allied militias were terrorists, suggesting that Libya might soon have two legislatures with competing armies.

Each side has the support of competing satellite television networks financed and, often, broadcast from abroad.“It is a struggle across the region,” said Hassan Tatanaki, a Libyan-born business mogul who owns one of the anti-Islamist satellite networks. “We are in a state of war and this is no time for compromise.”

He said he had also suggested moving the newly elected Parliament to Tobruk, and then he helped pay to transport it there, in Haftar’s turf. “If I try to think of all the money I spent, I will get a heart attack,” Tatanaki said.