(Reuters) - Sempra Energy SRE.N said it will buy Oncor for $9.45 billion in cash after Energy Future Holdings Corp, which indirectly owns Oncor, abandoned a deal to sell the power transmission company to Warren Buffett's Berkshire Hathaway Inc BRKa.N.

San Diego-based Sempra expects to own about 60 percent of a reorganized Energy Future after the transaction that is valued at $18.8 billion, including Dallas-based Oncor’s debt, it said late on Sunday.

The development represents a rare blow for Buffett, who avoids bidding wars for companies and had swooped in two months ago to buy Oncor after two previous attempts by Energy Future to sell it were blocked by Texas regulators.

In July, the energy unit of Berkshire Hathaway agreed to buy Oncor for $9 billion, but the deal ran into trouble after Energy Future’s biggest creditor Elliott Management Corp opposed the sale arguing it undervalued Oncor.

Elliott also tried to put together its own bid for $9.3 billion to buy Oncor.

Separately, Berkshire said last week it would not be raising its offer for Oncor, which delivers power to more than 3.4 million homes and businesses.

“Elliott is supportive of the proposed Sempra transaction, which provides substantially greater recoveries to all creditors of Energy Future than the proposed Berkshire transaction,” a spokesman for Elliott said in an email to Reuters.

Berkshire, which made the offer to Oncor in order to step up its pursuit of steady profits from utilities and infrastructure deals, did not immediately respond to a request for comment.

Sources told Reuters earlier that Sempra had decided to make an offer for Oncor in the last three weeks, after seeing the opposition that Berkshire faced from Elliott.

Energy Future’s board favored Sempra’s bid after it also offered assurances it could get its acquisition of Oncor approved by Public Utility Commission of Texas, as well as a U.S. bankruptcy judge, the sources said.

Sempra Energy said it expects the deal to be completed in the first half of 2018 and to add to earnings beginning next year.

Allen Nye, who is currently Oncor’s general counsel, will succeed Bob Shapard as the company’s CEO. Shapard will be named executive chairman of Oncor.

Lazard and Morgan Stanley were financial advisors to Sempra Energy and, White & Case LLP, acted as its legal advisor.