Natural gas-focused San Diego-based Sempra Energy made a late bid that allowed it to pluck off bankruptcy-bound Energy Future Holdings Corp. (EFH), the indirect owner of 80% of Texas-based Oncor Electric Delivery Co., for $9.45 billion in cash, topping one by Warren Buffett’s Berkshire Hathaway conglomerate.

The enterprise value of the transaction is estimated at $18.8 billion, including debt. The deal is expected to close in the first half of 2018, following approvals by the Texas Public Utilities Commission, U.S. Bankruptcy Court of Delaware, Federal Energy Regulatory Commission, and the U.S. Justice Department.

“Both Sempra Energy and Oncor share more than 100 years of experience operating utilities that deliver safe, reliable energy to millions of customers,” said CEO Debra Reed. Oncor is “an excellent strategic fit” for Sempra’s utility and energy infrastructure portfolio.

With San Diego Gas and Electric (SDG&E) and Southern California Gas Co. (SoCalGas) as its base, Sempra expects Oncor to expand its regulated utility base and provide future growth opportunities in the Texas energy market and the U.S. Gulf Coast region.

The transaction of the largest power distribution/transmission system in Texas should be accretive beginning next year, Sempra officials said. Reed said the purchase “will help ensure that Texas utility customers continue to receive outstanding electric service.”

Sempra has spent more than a decade building its gas portfolio, including liquefied natural gas export facilities, pipeline growth projects and a sizable and early plunge into Mexico. However, senior executives in several recent forums said the company also was interested in developing other electric transmission assets.

Late on Monday, Moody’s Investors Service analysts said the deal would weaken Sempra’s credit metrics and thus it called the acquisition “credit negative.” Moody’s is troubled by the fact the deal will increase Sempra’s debt levels at a time when delays in its Cameron LNG export project are “already pressuring credit metrics.”

Funding for the Oncor deal would come from a combination of debt, third-party equity and $3 billion of expected investment-grade debt at the reorganized Energy Future. Sempra said it has received financing commitments from RBC Capital Markets and Morgan Stanley, with Sempra expected to hold about 60% of the reorganized company.

In 2014 EFH, which was the 2007 product of the largest ever leveraged buyout, filed for bankruptcy after years of struggling against the shale boom, which drove down prices for electricity as well as gas. The Dallas-based Oncor holding company, formerly TXU Corp., at the the time struck agreements with key stakeholders to cut about $40 billion in debt, lower interest expenses, access additional capital “and create a sustainable capital structure for the future.”

After two earlier bids by other suitors failed, Berkshire Hathaway appeared to be set to make the acquisition, only to be blocked by investor Elliott Management Corp. in bankruptcy court, where the Berkshire bid was scheduled to be heard Monday.

Sempra plans to maintain the existing independence of Oncor’s board, which has protected the electricity company and its customers during the ongoing EFH bankruptcy that has dragged on for three years.

“It is important for Oncor to remain financially strong,” said Reed, who expects the transaction to bring a “satisfactory resolution” to the bankruptcy case. The purchase also should address the concerns of the Texas regulators, creditors, and the U.S. Bankruptcy Court, she said.

Sempra has committed to supporting Oncor’s ongoing plan to invest $7.5 billion over a five-year period to expand and reinforce its transmission/distribution network.

When the transaction closes, Oncor CEO Bob Shapard is to become executive chairman of the board, and Allen Nye, general counsel, would become CEO.

In response to the Sempra bid, Berkshire Hathaway CEO Greg Abel said he was disappointed, but said the company still would be looking for opportunities.

“We are extremely grateful for the strong support and extraordinary backing from all of the stakeholders in Texas,” Abel said. “Our experience working with Oncor, its management and employees, as well as the State of Texas, has been exceptional, and we can’t thank those involved enough for their professional and principled approach to the transaction.”

Through the agreed upon 47 regulatory commitments, Texas stakeholders “have rightly focused on protecting Oncor from unnecessary risk, including having no debt at intermediate holding companies,” according to Berkshire. The regulatory commitments were included in an agreement signed by five parties that supported the proposal.

“Texas is a great state for business, and we look forward to future opportunities to invest,” Abel said.