The long-running bankruptcy saga of Energy Future Holdings is coming to a close now that Texas has approved the sale of the company’s crown jewel.

The Texas Public Utility Commission authorized Sempra Energy’s $9.45 billion purchase of Oncor Electric Delivery, the state’s largest utility, on Thursday. It was the last major step needed to end the almost 4-year-old Energy Future bankruptcy, which rivaled Enron’s as the largest ever for an energy company. A bankruptcy court approved Oncor’s sale last month.

“It’s the end of a long and twisting road,” said Paul Patterson, a utility analyst for Glenrock Associates. “Sempra was able to prevail over several suitors.”

Hit by a collapse in natural gas prices, Energy Future was forced to sell Oncor, one of the most sought-after U.S. utilities, as it worked to restructure almost $50 billion in debt. Sempra beat out Warren Buffett’s Berkshire Hathaway Inc., NextEra Energy Inc. and a group backed by Hunt Consolidated Inc., which all tried and failed to buy the utility in recent years. Berkshire took a pretax loss of $837 million on a $2 billion Energy Future debt investment in 2013, and Buffett has called it “a big mistake,” saying he wishes he’d never heard of the company.

“Sempra Energy is committed to being a good partner for the state and is supportive of Oncor’s mission to provide Texans with safe, reliable and affordable electric service,” said Debra L. Reed, chairwoman, president and CEO of Sempra Energy, who called the approval a “significant milestone.”

PUC Chairman DeAnn Walker thanked Sempra for agreeing to the conditions that the agency required for an Oncor sale. Attendees at the meeting in Austin, Texas, broke out in applause as three-member commission voted to approve the transaction after many failed attempts.

“It’s so appropriate for a round of applause for all the work that has gone into this,” Commissioner Brandy Marty Marquez said. “It’s been enormous.”

Dallas-based Oncor offers steady, regulated returns in a state with a growing population and the highest electricity sales in the country. Oncor is Texas’ largest transmission operator, managing about 134,000 miles (216,000 kilometers) of power lines that deliver electricity to about 10 million customers.

Sempra runs power and gas utilities in Southern California, Chile and Peru that together serve more than 32 million consumers, according to the company’s website. It also owns and operates almost 2,400 megawatts of renewable energy capacity with partners, the Mexico pipeline and renewable developer IEnova and a liquefied natural gas export terminal project in Louisiana with partners.

“They like Texas,” Bloomberg Intelligence analyst Kit Konolige said of Sempra. “It’s obviously the center of the energy industry.”

Before the bankruptcy, Energy Future was the target of the largest-ever leveraged buyout, when it was taken private for $48 billion in 2007 by a group led by KKR & Co. and TPG Capital LP.