An all-consuming 19-month court fight with its creditors now all but over, the stage is set for cash-strapped Texas power giant Energy Future Holdings to exit bankruptcy court in the spring.

U.S. Bankruptcy Judge Christopher Sontchi ruled Thursday that the best thing for the company and its creditors was to split apart the former TXU Corp. Pending a series of regulatory decisions, the power plants and retail business TXU Energy would be handed over to creditors and the power line subsidiary Oncor sold to an investors group led by Dallas billionaire Ray L. Hunt.

The decision marked a victory for a company that six months ago appeared as if it might have another couple years to go in bankruptcy court, scrapping it out with its Wall Street creditors.

“We can now begin, in earnest, to build for the future,” Energy Future CEO John Young said in a statement to employees Thursday.

The former TXU Corp. filed for Chapter 11 protection in Wilmington, Del. in April 2014, claiming falling power prices in Texas had left it unable to pay debts largely amassed in a record $45 billion leveraged buyout seven years earlier.

Initially, Energy Future executives expressed hope they could bring together discordant creditors and be out of bankruptcy court within 12 months. But common ground proved difficult, as creditors across the company’s complex debt structure sparred over who would get what was left of assets that had plummeted in value along with electricity prices.

With $35 million a month in legal and professional fees, the delay was quickly running down the value of the estate.

The breakthrough came this summer when a group of junior creditors teamed with Hunt Consolidated said they would buy Oncor in a deal that values the company at close to $19 billion – besting an offer from Florida’s NextEra Energy.

“Pretty simply, they put their money where their mouth is. They had a total financing package whereas the junior creditors on the E-side never really had the dollars lined up,” said Sarah Gefter, a distressed debt analyst with Reorg Research, referring to a rival group of creditors.

With more money coming into the estate, one after another the creditors and other opponents, including the Justice Department, steadily agreed to settle with Energy Future.

By closing arguments in Wilmington Wednesday, the company had “virtually unanimous support,” said Marc Kieselstein, an attorney representing Energy Future.

The plan and settlement with creditors represented the best chance for a company that had struggled under out-sized interest payments for years, Sontchi said Thursday.

The reorganization plan sheds $30 billion in debt, he said, and brings an infusion of new investment that will “leave all of [Energy Future’s] businesses stronger.”

“The evidence overwhelming supports confirmation of the plan,” he said. Company executives have “not had an easy path and have had several adverse rulings in this court but have adjusted their position … I would extend my congratulations to them.”

The ruling comes none too soon for Energy Future, which has largely been left to sit on the sidelines as the power industry undergoes a historic shift.

Tougher environmental regulations and a flood of cheap natural gas are already forcing coal plants off the Texas grid. Energy Future has made some moves – last week it announced it was buying two natural gas plants in northeast Texas for $1.3 billion – but the company generated more than 70 percent of its electricity from coal last year.

“The future looks bleak for companies that burn a lot of coal,” said Michael Webber, deputy director of the University of Texas Energy Institute. “This is a pretty complicated time for the [power] industry, and EFH, like everybody else, is trying to figure it out.”

Even with court approval, the breakup of Energy Future has some ways to go. The deal is predicated on creditors not incurring a tax bill that could potentially run into the billions. The Internal Revenue Service is reviewing whether the transfer of assets to creditors represents a taxable sale, a decision that is not expected until next year.

At the same time, Hunt Consolidated has filed an application with the Texas Public Utility Commission to take over Oncor. What might have been a routine review has been complicated by the Hunts’ plan to convert Oncor into a real estate investment trust, a corporate structure that shifts tax liability away from the company to shareholders.

Ratepayers groups are already urging the PUC to pass that tax benefit on to customers. Hunt has not said what rate it would accept for Oncor, but among insiders there’s an understanding that if the concessions are too onerous the family might walk away.

A hearing on the Hunt takeover of Oncor is scheduled for January and is expected to stretch up to two weeks.