California’s Pacific Gas and Electric will pay $13.5 billion to settle lawsuits over its role in a series of wildfires that killed scores of people and destroyed thousands of homes, the utility giant said Friday.

Faulty PG&E power lines were blamed for sparking last year’s so-called Camp Fire in northern California — the deadliest in the state’s history — that left 86 people dead.

Outdated facilities including vulnerable wooden poles and failure to deforest land surrounding high-voltage transmission lines were blamed for the inferno, prompting accusations the San Francisco-based firm had put profit before safety.

The company filed for bankruptcy protection in January, saying it faced more than $30 billion in claims over the blaze.

It was also sued over three other fires dating back to 2015, including one that devastated the state’s wine region and killed more than 40 people two years ago.

The settlement would allow PG&E to come out of bankruptcy protection before a government deadline set for next June, the company said in a statement.

“We want to help our customers, our neighbors and our friends in those impacted areas recover and rebuild after these tragic wildfires,” said chief executive Bill Johnson.

“There have been many calls for PG&E to change in recent years. PG&E’s leadership team has heard those calls for change, and we realize we need to do even more to be a different company now and in the future,” he added.

The settlement will require approval by a bankruptcy court before it can proceed.

PG&E has faced a litany of legal problems in recent decades, including 737 counts of criminal negligence over failing to trim trees near power lines following a big fire in 1994.

Regulators with the California Public Utilities Commission found that the utility diverted $77.6 million from its tree-trimming budget to other uses, according to a lawsuit filed over a 2015 blaze in Butte County.

“During that same time, PG&E underspent its authorized budgets for maintaining its systems by $495 million and instead, used this money to boost corporate profits,” according to that claim.

The company was also fined $1.6 billion over a 2010 gas pipeline explosion in San Bruno, California that killed eight and injured 58.