FILE - In this Aug. 15, 2019, file photo, a Pacific Gas & Electric worker walks in front of a truck in San Francisco. California’s Pacific Gas & Electric is faced regularly with a no-win choice between risking the start of a deadly wildfire or immiserating millions of paying customers by shutting off the power. (AP Photo/Jeff Chiu, File)

The utility that serves more than 5 million electrical customers in one of the world’s most technologically advanced areas is now faced again and again with a no-win decision: risk starting catastrophic deadly wildfires, or turn off the lights and immiserate millions of paying customers.

Pacific Gas & Electric is in bankruptcy, facing $30 billion in liabilities, billions more in needed upgrades to its system and an uncertain path to safely providing reliable power to a vast portion of California.

How that came to be is a story not of a single villain but of systemic failure by the utility’s management, the regulators who oversee it and the politicians who let it all happen. It’s a story of climate change, a housing crisis and an aging power system that, like much of the U.S. infrastructure, has fallen into disrepair.

“There’s a ton of blame to go around here,” said Christopher Knittel, director of the Center for Energy and Environmental Policy at the Massachusetts Institute of Technology’s Sloan School of Management.

The problem and its potential solutions have jumped to the top of the California political agenda. But most experts agree: Even under the best scenarios, the fires and widespread power shutoffs will be here for years to come. In the meantime, Californians will pay higher prices for less reliable energy.

“It’s not just going to be a PG&E cost, isolated from impact on the consumer,” said Matthew Cordaro, a longtime utility executive and a trustee for the Long Island Power Authority, which sustained significant damage during Superstorm Sandy in 2012. “The consumer’s going to have to pay for it.”

The danger from a growing number of people living next to power lines and dry forests as the climate changes wasn’t unknown, but it wasn’t front of mind before electrical systems started a series of fires that swept through Northern California two years ago, leaving a trail of destruction and killing dozens. What seemed unthinkable was repeated just a year later, when PG&E power lines started the Camp Fire that destroyed the town of Paradise and killed 85 people.

PG&E operates some 125,000 miles (200,000 kilometers) of power lines, enough to wrap around the equator five times. Much of the system traverses remote forests that are dry from years of drought and dense from a lack of logging or natural fires. California has 138 million dead trees, all of them potential fuel for fire.

Meanwhile, a shortage of housing in cities — and stiff resistance to building more — has pushed new construction into forested areas, where there are few barriers to building.

And the climate is warming. While scientists can’t blame climate change alone for any one fire, they say it contributes to drier brush, hotter temperatures and stronger winds, all of which help flames spread farther, faster. Five of the 10 largest fires and seven of the 10 most destructive have happened in the last decade. The deadliest were started by power lines.

More than half of PG&E’s 70,000 square miles (181,000 square kilometers) of service territory is designated as high risk for fires, according to the company’s wildfire mitigation plan submitted this year to the state’s utility regulator, the California Public Utilities Commission.

Operating in that environment poses challenges for any company, but PG&E has an especially checkered past.

The company neglected to maintain its systems so egregiously that it was found criminally liable for a deadly explosion in its natural gas system that killed eight people and destroyed dozens of homes in San Bruno, California, in 2010. It was fined and placed on probation when a jury found the company cut corners on safety and misled investigators in an attempt to cover it up.

Gov. Gavin Newsom has accused PG&E of prioritizing its shareholders and executives over the maintenance, upgrades and tree trimming that could prevent wildfires and limit the misery from intentional blackouts. The company has reported it still has 2,700 miles of outdated copper wire, which is prone to breakage and arcing, in high-risk fire zones.

“A lot of money went to dividends that should’ve gone to your trees. Get square with the people of California, who depend on you to do the job safely,” U.S. District Judge William Alsup told a PG&E lawyer during an April probation hearing, KQED News reported.

PG&E has acknowledged shortcomings in its first big power shutoff and agreed to rebate affected customers, but CEO Bill Johnson has repeatedly said the blackouts protect the public. He’s said it will take a decade to get PG&E’s system to a place where widespread blackouts aren’t necessary.

Company officials say they’ve invested $27 billion in their power system over the past decade.

For all PG&E’s faults, power companies operate in one of the most highly regulated industries in the country, their investments overseen by the CPUC, which failed to foresee the fire risk or adequately force PG&E to prepare for it.

“The PUC is tasked with overseeing PG&E and making sure they’re making decisions in the interest of the public good,” said Knittel, of MIT.

California regulators and lawmakers squandered an opportunity to impose sweeping changes on a hobbled PG&E nearly 20 years ago when the utility landed in bankruptcy court the first time, after California’s energy crisis.

Instead, after three years of wrangling, PG&E worked out a plan, much of it in secret, with a former utility industry executive, Michael Peevey, then-president of the CPUC.

Other regulators and consumer activists tried to block that deal, calling it a travesty. But after a few minor concessions, PG&E emerged from bankruptcy protection in April 2004 with a customer-backed $7.2 billion bailout that enabled it to charge abnormally high electricity rates for nearly a decade. The surcharges, designed to help PG&E recoup part of the losses that drove it into bankruptcy, cost customers an average of $1,300 to $1,700 apiece.

Bailout supporters argued customers would be able to count on safe, reliable power.

But it hasn’t turned out that way. Getting to safe, reliable power will still require billions of dollars in system upgrades and extensive tree-trimming to keep branches and trunks from blowing into power lines.

Hardening the grid also involves replacing outdated poles and power lines, and insulating, or in dangerous areas, burying lines, which can easily cost millions of dollars per mile. Weather sensors and cameras help utilities predict and track dangerous weather. Sectionalizing lines, as other California utilities have done, allow more targeted blackouts so millions aren’t left in the dark when winds pick up, as they were three times in October.

Grid hardening can help limit the frequency and the breadth of power shutoffs and wildfires, but the danger can’t be totally eliminated.

“There’s no way to completely protect the electricity grid and control all of its interactions with the environment around it,” said Ted Kury, director of energy studies for the Public Utility Research Center at the University of Florida. “Any place you locate power lines there’s going to be a tradeoff.”

Shareholders and bondholders are competing to control the company once it emerges from bankruptcy, and there are also proposals to redesign its ownership, have cities take a stake, or more broadly overhaul regulations.

Newsom has said the regulator’s problems are in the past after his appointment of a new head of the CPUC. He’s been deeply critical of PG&E, saying the utility “as we know it cannot persist and continue.” He’s pushed the company to work through issues and get out of bankruptcy by next summer, even threatening a takeover.

PG&E’s chief executive has resisted the more ambitious restructuring proposals.

"I think the way it is structured now is the best idea for the majority of customers," Johnson told reporters.

Kris Mayes, Arizona’s former top utility regulator who now leads the Utility of the Future Center at Arizona State University, said PG&E should be broken into two or three more manageable entities, and California should shift to “performance-based regulation” that rewards utilities for things like safety, reliability, customer service or the amount of renewable energy. Utilities now are awarded a fixed profit on their investments. The need for long-distance transmission lines could be reduced by conserving energy and generating and storing more of it locally, she said.

“The utilities have been rewarded over decades for building big stuff, including these power lines that are now causing fires,” Mayes said.

Whatever route PG&E goes, it still faces extensive debt for its existing infrastructure and stiff liabilities from starting the two deadliest and most destructive wildfires on record in United States history. Those costs, and likely the cost for system upgrades, are likely to be passed to its customers.

“This is an unacceptable situation in California, and no utility should ever put its customers in harm’s way,” Mayes said. “It’s just not supposed to happen.”

FILE - In this Oct. 10, 2019, file photo, a helicopter drops water near power lines and electrical towers while working at a fire on San Bruno Mountain near Brisbane, Calif. California’s Pacific Gas & Electric is faced regularly with a no-win choice between risking the start of a deadly wildfire or immiserating millions of paying customers by shutting off the power. (AP Photo/Jeff Chiu, File)
FILE - In this Oct. 18, 2017, file photo, a Pacific Gas & Electric worker replaces power poles destroyed by wildfires in Glen Ellen, Calif. California’s Pacific Gas & Electric is faced regularly with a no-win choice between risking the start of a deadly wildfire or immiserating millions of paying customers by shutting off the power. (AP Photo/Ben Margot, file)
FILE - In this Dec. 3, 2018, file photo, homes leveled by the Camp Fire line the Ridgewood Mobile Home Park retirement community in Paradise, Calif. California’s Pacific Gas & Electric is faced regularly with a no-win choice between risking the start of a deadly wildfire or immiserating millions of paying customers by shutting off the power. (AP Photo/Noah Berger, File)