BENGHAZI, Libya — We fight terrorism for the sake of the world, reads the billboard overlooking one of this strife-torn city’s upscale streets. It also bears the visage of a mustachioed, uniformed man—Field Marshal Khalifa Haftar, Libya’s most powerful and polarizing figure. Coming from him, the billboard’s message is a most striking assertion.

When I went to Libya just over three years ago, then-General Haftar gave me a variation of this same line. “Libya will be the graveyard of international terrorism,” he predicted. Those were the early days of Operation Dignity, Haftar’s military campaign to rid Benghazi of Islamist and jihadist militias, who’d ensconced themselves in the city since the 2011 revolution. He’d promised the operation would be over in weeks. This May, the war in Benghazi passed its 36th month—longer than the uprising that unseated dictator Muammar Qaddafi. The conflict has killed and displaced thousands, and caused devastation on a scale not seen in the country since the Second World War.

Today, Haftar can claim some success. His forces have decimated the Islamists, pushing them back to just a few seaside blocks on Benghazi’s fringes. Life is returning to the city. But along the way, his operation has unleashed new, destabilizing forces, the greatest of which have been a resurgent authoritarianism and the political rise of Haftar himself, in defiance of the UN-backed government in Tripoli. It is an ascendancy abetted by support from an Emirati-Egyptian axis and, more recently, signaling from the Trump administration. And its aftershocks are rippling far across the country.

* * *

The roots of Operation Dignity lie in the aftermath of the 2012 jihadist attack on the U.S. diplomatic mission that killed Ambassador J. Christopher Stevens and three other Americans. In the months that followed, Benghazi fell into despair, all but forgotten by the world. Assassinations terrorized residents; drive-by shootings and car bombs felled judges, activists, security guards, and military officers. Nobody went out at night. The motives for the killings were murky—a mix of Islamist violence, tribal feuds, and criminality. Whatever the case, residents longed for order, for someone to stop the chaos.

Enter Haftar. The septuagenarian officer had fought in Qaddafi’s war in Chad before defecting and fleeing, with CIA assistance, to Virginia, where he lived for nearly 20 years. Returning to Libya during the 2011 revolution against Qaddafi, he tried and failed to lead the rebels. He all but disappeared from view, traveling around Libya with his retinue, an itinerant claimant to a destiny that eluded him. In February 2014, he appeared on television and announced the dissolution of the elected parliament, meeting only ridicule. “The coup that wasn’t,” people called it. Then, that summer, amid Benghazi’s intractable violence, he found his opening. With just a few hundred followers drawn from disaffected army units and eastern tribes, and some dilapidated aircraft, he launched Operation Dignity to take on the city’s Islamist militias. Within a year, his forces controlled most of the east. The campaign was unsanctioned by the Tripoli government and would soon throw the country into civil war.

Operation Dignity, Haftar explained to me then, sought not only to drive out the Islamists, but to reclaim the honor of the uniformed officers who’d been sidelined by militias. He complained that the officers of the ex-regime were paid far less than untrained Islamist militias with ties to jihadists, and blamed the situation on the corruption of the parliament and civilian leadership in Tripoli. Most importantly, though, Haftar wanted to remake Libya’s politics by expunging political Islamists, especially from the Muslim Brotherhood, who he accused of complicity in the violence. This goal aligned neatly with the policies of Egyptian strongman Abdel Fattah El-Sisi, whose speeches Haftar copied and whose military and political support would prove vital.

Haftar predicted the fighting would be over in weeks. The weeks became months; the months turned into years. International aid poured in to support Haftar’s forces; foreigners, meanwhile, swelled the ranks of Haftar’s foes as well. The United Arab Emirates, with its own phobia of the Brotherhood, joined the Egyptians in sending armored vehicles, advisers, and attack aircraft. Russia lavished Haftar with attention: a theatrical visit to an aircraft carrier, medical assistance, and, reportedly, special forces. The French, the British, and the Americans sent special operators who provided varying levels of intelligence and front-line support.

But Haftar had erred. By attacking the Islamists, he had lumped moderates together with jihadists and, as time wore on, the balance of power shifted to the radicals, bolstered by an influx of Tunisians, Egyptians, and other foreigners. In early 2015, the Islamic State arrived and exploited the chaos. Islamists who might’ve reconciled with the Libyan state were killed off or exiled, or they cast their fates with the so-called caliphate.

By late 2015, when I visited Benghazi, Operation Dignity was locked in a stalemate. I visited field hospitals where I saw Haftar’s men torn apart by mines and snipers. Vast swathes of the city were no-go zones.

* * *

When I returned this May, I found a battlefield completely changed. Haftar’s forces had all but declared victory.

To be sure, fighting still rages, and parts of the city lie in ruin, including the iconic old city and its courthouse, site of the first protests against Qaddafi in 2011. The expansive, recently liberated Fish Market district, where families once gathered on Ramadan nights, is now a shamble of concrete. Shelling has scarred the Italianate porticos of Tree Square, once beloved for its cedar, and destroyed the covered bazaar of Suq al-Jarid, once filled with tailors, jewelers, and leather-smiths. Soldiers still fall from sniper fire and, especially, booby-traps—diabolical devices triggered by thin planks of wood covered with sand, trash, or grass. Civilians still perish from salvos of rockets or mortars, often at night. One morning I witnessed the aftermath of such an attack: a gaping crater, an incinerated car, and a young man grieving for his brother.

Yet in many parts of the city I felt the pulse of normalcy. In the old district of Birka, the green-checkered flags of the Nasr football club, a local favorite, crisscross the bustling streets. Traffic police who once cowered at home for fear of assassination are stationed once again at intersections, wearing their summer white uniforms. Factories and farms are creaking back to life, while younger entrepreneurs try their hands at tech start-ups, participating in competitions for innovative app designs. The university is reopening.

Leisure has returned as well. At the Luna Mall, children play on a toy train next to ice cream parlors, candy stores, and clothing outlets. There are musical clubs, theater troupes, art galleries, and rugby tournaments. Sitting on the lawn of a new hotel, newlyweds smoke apple-flavored tobacco while a projector plays Egyptian soap operas on a wall.

This is one face of Benghazi—the one of progress and order. There is, of course, another side.

* * *

Benghazi’s war is not simply an army operation against terrorists, but a deeply intimate social conflict, between neighbors and cousins, overlaid with tribal- and class-based tensions, between eastern tribes and families from the west, among eastern tribes, and between urban elites and rural poor. Reports of torture, disappearances, and the destruction of property emerge with numbing frequency. So, too, has evidence of summary executions, on both sides.

Tribal and neighborhood militias armed by Haftar early in his campaign have carried out many of the abuses. These militias, known as “support forces,” at one point comprised as much as 60 to 80 percent of his men, and they retain power today, despite efforts to disband them. Many of them have attacked the families of suspected militants, demolishing their homes and businesses. A Dignity commander once justified this destruction in the interests of saving Benghazi’s “social fabric.” Of course, precisely the opposite occurred.

I found evidence of the desecration while driving through Benghazi’s Laythi neighborhood, a poor, densely packed quarter with a reputation for militancy and scrappiness. I passed the blackened ruins of burned-out houses and stores and the tawny skeletons of cars. Some of the pillaging seemed invested with class rivalry, an expression of resentment by poorer tribes against the wealthier Islamists. I met one leader of a pro-Haftar militia that attacked the home of an alleged jihadist financier who owned an aluminum workshop where he’d once apprenticed.

Many of those fleeing the vigilante attacks in Laythi and other neighborhoods now form the social backbone of the militant opposition to Haftar. Thousands of families have been forced from Benghazi, many simply because their male relatives are fighting Haftar. Still other refugees claim to have been targeted by Haftar’s militias solely because of their distant family origins, especially those who hail from western towns like Misrata, a coastal powerhouse that has armed and funded the Islamists opposing Haftar.

In Misrata, I met several of the militiamen who’ve shipped weapons to the Islamists fighting Haftar. They complain that his war has stoked a new nativism among some of the eastern tribes allied with Dignity. Those whom these tribes deemed not native to Benghazi and the east they brand as ghuraba, or “westerners.” No matter that Misratan families had migrated to Benghazi centuries ago, settling in the city’s downtown, where they thrived as traders and builders. Now, tribes who came to Benghazi in recent decades from its rural environs accused them of not belonging. Even worse, they labeled the Misratans Turks or Circassians, references to the Misrata’s historical links with the Ottoman Empire. “This is a tribal racism,” said one of them.

Like many narratives of victimization, this one includes some distortion. The ranks of those opposing Haftar include eastern tribes, just as Haftar’s supporters include people from Misrata and the west. This is what makes the conflict in Benghazi so confounding: It cuts across communal lines and divides families. What is clear, however, is that the spirit of militant revanchism animating the displaced and those fighting Haftar, is likely to endure. “Whoever controls Benghazi controls Libya,” one of them told me.

Another byproduct of Operation Dignity has been a surge in conservative Islam in Benghazi and across the east. Despite the common portrayal of Haftar as secular and anti-Islamist, he has co-opted and supported conservative, Saudi-inspired Salafists. These so-called “quietist” Salafists embrace a doctrine of loyalty to a sitting political ruler and hostility to more activist and jihadist forms of Islamism, like the Brotherhood and al-Qaeda. Unsurprisingly, they joined Dignity from the beginning. They later sent a delegation to Saudi Arabia to secure a fatwa from their clerical mentor in Saudi Arabia authorizing support for Haftar.

In recent months, the pro-Haftar Salafists have attempted to consolidate their control of security affairs and social life in Benghazi and to the east. They field their own militia, and deploy it across the city’s frontlines. They are also active in prisons; I met one of them who works on the theological “rehabilitation” of captured jihadists. The Salafists also function as a sort of morality police. They have confiscated and burned books deemed heretical and shut down an “Earth Day” celebration, branding it as un-Islamic. Their influence unnerves many of Haftar’s liberal supporters: They thought he’d restore security and oust the Islamists, not unleash Islamists of his own.

Even more unsettling is Haftar’s militarization of governance. Across the east, he has replaced elected municipal leaders with uniformed military officers. The Qaddafi-era intelligence apparatus is back on the payroll. Critical voices have been silenced through expulsion, arrest, or even disappearance—a return, many whisper, to the bad old days.

* * *

Haftar appears poised to move beyond Benghazi and take to the national stage. He has made no secret of his intention to move west to Tripoli to topple the Islamist militias holding sway in the capital. He’s already grabbed oil facilities in the central Sirte Basin and recently seized southern airfields from his opponents. He’s also sought international endorsement.

Last fall, Haftar sent envoys to Washington and pitched to the United States the idea of ruling Libya through a military council, only to be rebuffed. The redline for Washington, according to a senior U.S. official present at those meetings, was civilian control over the Libyan military. More recently, Haftar has shifted tack to accept a civilian position overseeing Libya’s military in a three-person governing council, or to run as a candidate in Libya’s presidential elections, currently scheduled for early 2018. His critics remain suspicious, seeing in this switch a back-door route to dictatorship.

I found signs of Haftar’s attempted rebranding in another, newly erected billboard. This one stands in Benghazi’s expansive Kish Square, a site of frequent demonstrations where at night young men “drift” in souped-up cars. Haftar appears on the sign wearing a grey suit and tie, flanked by adoring crowds. “The Popular Authorization Movement for Saving the Country,” the words beneath him read. At a nearby tent, one of the Movement’s organizers explained its goal: to obtain 400,000 “notarized” signatures “authorizing” Haftar to govern the country.

It has the trappings of a political campaign, one that has been hastened by recent Egyptian and Emirati military activity on Haftar’s behalf, and the misfortunes befalling Qatar, the patron of his Islamist opponents. Added to this are the encouraging signals from Trump’s Middle Eastern forays. Whereas the Obama presidency kept the general at arm’s length, Trump’s counter-terrorism focus, anti-Islamism, and embrace of Arab despots are a godsend for Haftar.

Back in Benghazi, a sense of buyers’ remorse seems to weigh on some of Haftar’s onetime supporters. For them, the saga of his comeback from the wilderness, his rescuing of a troubled city, and his rise to national dominance carries all the makings of a personality cult, one with echoes from the not-too-distant past.

“We’ve come to regard him as a mini-god,” a local activist confided, “and that’s dangerous. That’s what we did with Qaddafi.”