NextEra Energy is the lucky bidder to buy Texas distribution utility Oncor in a deal valued at $18.4 billion.

Oncor’s parent company, Energy Future Holdings, has been in bankruptcy for more than two years. It is one of the largest bankruptcies in American history. NextEra will acquire all of the equity of a reorganized Energy Future Holdings, including its 80 percent stake in Oncor. Energy Future Holdings’ power plants and retail business will be spun off to creditors. 

Bidding had been robust for Oncor, with interest from energy companies and others including Berkshire Hathaway, Edison International, Hunt Consolidated and Fidelity Investments.

For NextEra and Oncor, it is a chance to move on after other deals have recently fallen apart. For Oncor, it seemed like Hunt Consolidated was going to move forward, but then that company withdrew its bid in May due to regulatory restrictions. Earlier this month, NextEra was summarily denied its bid in a 2-0 vote to acquire Hawaiian Electric Industries after nearly two years of jockeying for ownership of HECO.

Both deals were not necessarily a natural fit, while NextEra and Oncor are a better-suited relationship. Though Hunt Consolidated is a Texas company, bringing a distribution utility into something that looked like a REIT structure seemed bizarre and too complex to many people, including regulators.

In Hawaii, the public never really got behind NextEra. Regulators cited their belief that the deal was not in the public interest as one of the main reasons for rejecting it. NextEra may have learned something from that experience, offering a detailed list of bullet points in its press release about the benefits of the deal to Oncor and its customers.

It also helps that NextEra already has a presence in Texas as owner of the transmission provider Lone Star Transmission. NextEra also owns several wind farms and a natural-gas pipeline in the state. Additionally, NextEra owns Florida Power & Light, another utility that has experience dealing with hurricanes and strong storms. NextEra touted the fact that FPL customers have the lowest electric bills in Florida and that the utility is among the most reliable in the U.S.

“NextEra Energy’s proven track record of providing affordable, reliable electric service for customers complements Oncor’s operational strengths, and is at the core of why we believe this transaction will be a significant benefit for Oncor and for Texas,” Jim Robo, chairman and CEO of NextEra, said on an investor call.

There has been a steady stream of energy companies buying up regulated distribution utilities in recent years. While NextEra Resources does not have any coal in its portfolio and two-thirds of its generation mix is wind, regulated utility assets are an attractive part of a diversified energy company to offset the volatility of wholesale markets.

Earlier this year, Exelon’s merger with Pepco was approved, and Exelon is also hedging its generation with a recent purchase of energy retailer ConEdison Solutions. In 2012, Duke bought Progress Energy to form the largest utility in the U.S. shortly after Exelon merged with Constellation.

When NextEra’s acquisition of Oncor is complete, NextEra Energy is expected to have combined assets of $102 billion, up from $82 billion today. The deal is expected to close in the first quarter of 2017.