Those backing Mr. Badi say his attack was a pre-emptive blow against an imminent counterrevolution modeled on the military takeover in Egypt and backed by its conservative allies, Saudi Arabia and the United Arab Emirates.
Their opponents, including the militias stocked with former Qaddafi soldiers that controlled the airport, say Mr. Badi was merely the spearhead of a hard-line Islamist onslaught resembling the Islamic State in Iraq and Syria 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 costal city of Misurata — many Libyans despaired of any resolution.
“We entered this tunnel and we can’t find our way out,” said Ibrahim 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 Mr. Badi’s allies finally captured the remaining rubble, at least for the moment. Constant shelling between rival militias has leveled blocks, emptied neighborhoods and killed hundreds of people. Storage tanks holding 90 million liters 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 gas 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 toward war is also lifting the fortunes of the Islamist extremists of Ansar al-Shariah, the militant group involved in the attack on the American Mission in Benghazi, as other militias have allied with its fighters.
The United Nations, the United States and the other Western powers have pulled 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. (The United Nations is sending a special envoy, Bernardino León, to try to arrange a truce.)
Even the first years after Colonel Qaddafi’s ouster were better, said Hisham Krekshi, a former Tripoli councilman, savoring a few hours of uninterrupted electricity in the upscale cafe that 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 now in tatters, and with it the hope that nonviolent negotiations might settle the competition for power and, implicitly, Libya’s oil. In May, a renegade former general, Khalifa Hifter, 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-Shariah, blamed for a long series of bombings and assassinations.
Borrowing lines from President Abdel-Fattah el-Sisi of Egypt, General Hifter also pledged to close the 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-Shariah 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-Shariah, speaking last week after meetings in Misurata. “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 Mr. Bozakouk.
Last week, a broad alliance of Benghazi militias that now includes Ansar al-Shariah 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 now stalled, it polarized the country, drawing alarms 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 Qaddafi soldiers into special brigades, while also keeping control of the Tripoli airport.
The alarms went off in the rival coastal city of Misurata, where militias have allied with the Islamists in political battles and jostled with the Zintanis for influence in the capital. Since Colonel Qaddafi’s ouster, the Misurata and Islamist militias developed a reputation for besieging government buildings and kidnapping high officials to try to pressure the 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 Mr. Hifter, announced plans to convene in Tobruk, an Eastern city under the general’s control.
About 30 members, most of them Islamists or Misuratans, refused to attend, dispelling hopes that the new legislature might unify the country. “That is foreign territory to me,” said Mr. 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, favored by the Islamists and Misuratans, declared that it would reconvene in Tripoli. In Tobruk, a spokesman for the new Parliament declared that the Islamist- and Misuratan-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, typically from Qatar for the Islamists and from the United Arab Emirates for their foes.
“It is a struggle across the region,” said Hassan Tatanaki, a Libyan-born business mogul who owns one of the anti-Islamist satellite networks, speaking in an interview from an office in the Emirates. “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 General Hifter’s turf. “If I try to think of all the money I spent, I will get a heart attack,” Mr. Tatanaki said.
Fighters and tribes who fought one another during the uprising against Colonel Qaddafi are now coming together on the same side of the new fight, especially with the Zintanis against the Islamists. Some former Qaddafi officers who had fled Libya are even coming back to take up arms again.
“It is not pro- or anti-Qaddafi any more, it is about Libya,” said a former Qaddafi officer in a military uniform, who had returned from Tunisia. He lounged against the wall of a mountainside guardhouse full of Zintani fighters who were his foes three years ago.
Beneath the battle against “extremists,” he said, was an even deeper, ethnic struggle: the tribes of Arab descent, like the Zintanis, against those of Berber, Circassian or Turkish ancestry, like the Misuratis. “The victory will be for the Arab tribes,” he said. He declined to provide his real name, insisting all journalists were spies.
Those sympathetic to Mr. Badi’s assault on the airport argue that his fight is an extension of the fight against General Hifter’s anti-Islamist coup, arguing without evidence that their opponents were using the Tripoli airport to bring in weapons and equipment from abroad.
Mr. Badi “wanted to have them for lunch before they had him for dinner,” Mr. Krekshi, the former Tripoli councilman and a member of the Muslim Brotherhood, said. (The Brotherhood has said it takes no side in the armed struggle and seeks only dialogue, but in an interview the chief of its political office also refused to condemn the airport assault.)
Misurata city leaders said they had no warning of Mr. Badi’s attack. But the city’s powerful militias swung in full force behind him, and city leaders said the presence of former Qaddafi soldiers among the Zintani militia at the airport convinced them that there was no room to compromise.
“We are sorry for the bloodshed, but this is a necessary surgical operation,” said Abdel Rahman al-Kisa, a lawyer tapped to speak for Misurata’s city leaders, coolly defending the destruction of Tripoli. (Fuel, food, and electricity are still plentiful in Misurata, which has its own airport and seaport, and checkpoints force departing cars to empty any gas cans.)
In Zintan, on the other side of the fight, city leaders said Mr. Badi personified the extremist threat: as an ultraconservative former lawmaker, he once scolded a hostess at the inauguration for her uncovered hair.
“It is creeping up on us,” said Mr. Omar, the Zintan leader. “It is going to be like a new Afghanistan.”
In Misurata, several local leaders suggested that opposing cities were under the domination of armed Qaddafi loyalists and still in need of liberation. Elsewhere, several fighters even said they no longer believed that the rival cities, Zintan and Misurata in particular, could coexist as a nation. “When the dust settles, Misurata will be alone, because their arrogance has created so many enemies,” Ali Mohamed Abdullah, a Zintani fighter, declared.
Taking stock of the damage Tripoli has already suffered, another fighter, Amr el-Taher el-Sayed, shook his head. “Libyans have become monsters,” he said.