In the Lebanese town of Zahle, hundreds of solar panels glitter atop red-tiled roofs and spread across the grassy foothills beneath the Bekaa Valley’s snow-capped peaks. Glancing around, one might think this chronically power-starved Mediterranean country is on the cusp of a green energy revolution.

But Zahle is the only town in the country with a reliable source of power. Just outside the city limits, the panels disappear. Here, as with most of the country, jumbles of wire strung between electrical poles and buildings blot the sky, connecting shops and homes to massive, semi-legal diesel engines run by some of Lebanon’s most notorious characters, often referred to as the “generator mafias.”

These private generator owners are a holdover from the country’s 1975-90 civil war, when they began to fill the gap left by the destruction of the national grid. Experts estimate the gap between Lebanon’s energy supply and demand to be as much as 1 gigawatt in a country of about only 4 million people, leaving citizens without power from the official grid for as many as 12 hours per day. Today, however, a mounting groundswell of support for renewable energy and a global boom in solar technology is beginning to erode their immense power.

Over the years, the wealth and influence of Lebanon’s generator owners grew as political dysfunction and continuing conflict—including assassination, mass protests and a 2006 Israeli bombing campaign—hamstrung efforts to fix the national grid. Today, the so-called mafia controls a market worth anywhere from $1.5 billion to $2 billion, according to Ali Ahmad, an energy policy specialist at the American University of Beirut’s Issam Fares Institute, and stands in the way of anyone pursuing energy reform.

Many generator owners have gained influence over energy policy by building relationships with municipal officials and politically connected fuel importers, environmental activists say. “In the generator sector, all of these groups are tied to leaders in power,” said Naji Kodeih, an environmental consultant with Green Area, a Lebanese environmental publication. “And all of them provide services to these powers—commissions, money, donations. … That’s what’s preventing the country from having electricity.” He added: “In the end, the Lebanese citizen, the Lebanese economy, and the country’s development all pay the price for a parasitic mafia network of interests.”

About three years ago, Zahle managed to break the cycle. Citing a 1920s concession agreement with the Lebanese government to produce and distribute power in the area, the local private utility, Electricite de Zahle (EDZ), leased diesel generators from a Britain-based firm and pumped the energy into the local grid. By covering the power gap left by the state utility and offering a single, cheaper bill, rather than the two bills residents had been paying (one to the state utility, another for their local private generator), EDZ was able to push hundreds of smaller generators out of business.

The mafias fought back by burning tires and blocking streets. EDZ said someone shot at the plant’s transformers and threatened its chief executive. In the end, the protests died down and the generator owners moved on—thanks largely, the company says, to substantial support from the public for its effort. “If we didn’t have support from the residents, we couldn’t have continued with the project,” said Nicolas Saba, head of the utility’s technical department.

Since then, 24-hour power has made Zahle the only town in Lebanon where a national law allowing net metering—an arrangement whereby individual solar panel owners essentially sell power back to the grid—can take real effect. Francois Farage, manager of Green Essence, a solar panel installation company, said the boost has helped propel the number of installations his company performed from around two or three in 2013 to a total of more than 150.

Yet, outside Zahle, the picture changes dramatically. To keep solar systems economical, clients must convince local generator owners to set up a miniature net-metering system on their own networks—something Farage says generator owners almost universally reject out of fear of losing income. “Outside Zahle, they are the decision-makers, so of course we had some problems,” he said.

These negotiations can become unpleasant. Rony Karam, a Lebanese investor working on a real estate project a few miles outside Zahle’s grid, said he recently approached a local generator owner to see if he would help fill the power gap on a new village-scale micro-grid run largely on solar energy.

To his surprise, the man refused to consider it. “It was either solar or generator; he wouldn’t accept both. So that was it,” Karam recalled.

Still, Karam says that if his project in the Bekaa is successful, it could provide a model for hundreds of villages in Lebanon to establish their own micro-grids. “There is a lot of will, at least by a few people, to promote greenery but also, indirectly, to fight corruption,” he said.Despite the entrenched interests keeping Lebanon’s power grid dysfunctional, many see a vibrant future for the renewable sector. The country sees more than 300 sunny days a year, ideal conditions for solar energy. A central bank program providing low-interest loans for solar projects has spurred hundreds of installations, said Pierre El Khoury, general director of the Lebanese Center for Energy Conservation, a government agency affiliated with the Ministry of Energy and Water.

The country is on track to provide 12 percent of its energy from renewable projects, including private panel installations and solar water heaters, by 2020, Khoury said. A recent tender for three wind farms in northern Lebanon has opened a model for private companies to get involved in large-scale electricity generation for the first time.

Critics say such goals fall far short of Lebanon’s potential, however. Jordan, Egypt, Morocco and the United Arab Emirates all have solar farms that dwarf Lebanon’s largest projects.

Rabih Osta, general manager of Phoenix Energy, a major Lebanese solar company, said that it’s time for Lebanon to consider a gigawatt-scale solar project that could effectively plug the country’s energy gap. “If each year the individual market doubles or triples, it proves we are the right track, but it’s time to think on a bigger scale now,” he said.

As such projects gain momentum, they may well encounter even fiercer resistance from generator owners and other vested interests such as fuel importers, just as traditional power plants have. Ahmad, of the Issam Fares Institutes, suggests that when they do, the best strategy may to try to bring those involved in it into the process, rather than push them away.

“Will renewable take over generators? Of course. It’s just a matter of time,” Ahmad said. “Ideally, we should incorporate them in the planning, and we should offer them some sort of ownership in this green economy.”