A U.S. judge on Sunday approved General Motors Corp's bankruptcy sale, in a move that will allow the company's most profitable assets to exit bankruptcy protection under government ownership.

Judge Robert Gerber of the U.S. bankruptcy court in Manhattan said the sale would prevent the death of the patient on the operating table.

GM, which filed for bankruptcy protection on June 1, had argued that it would be forced to liquidate if the sale was not approved. The U.S. government said it could walk away from funding the automaker if a deal was not approved by July 10.

If GM liquidates, there will not only be nothing for stockholders; there will be nothing for unsecured creditors, Judge Gerber said in a 95-page opinion.

Under the deal, New GM will operate the best parts of the old company, including its Chevrolet and Cadillac brands, with a less-expensive workforce, smaller dealer network, and much less debt.

The old GM, which includes unpopular brands and unneeded factories and liabilities, will remain behind in bankruptcy court to be liquidated.

The U.S. Treasury has agreed to provide $60 billion in financing to the new company, including a proposed $50 billion that would give the U.S. Treasury a 60 percent stake in the company.

The UAW would gain a 17.5 percent stake, the Canadian government would own about 12 percent, and GM bondholders would be expected to obtain about 10 percent of the new company.

At a three-day sale hearing that concluded July 2, some small bondholders had objected to the deal, but no other bidders presented an alternative, and the 100-year-old automaker warned of catastrophic consequences to the auto industry if the sale was blocked.

A successful sale of GM's main assets is the second big victory for the Obama administration's auto task force. It helped broker the sale of Chrysler LLC to a group led by Italy's Fiat SpA last month.

A task force official said earlier this month that the government could conduct an initial public offering for the New GM as soon as 2010.

The case is In re: General Motors Corp, U.S. Bankruptcy Court, Southern District of New York, No. 09-50026.

(Additional reporting by JoAnne Allen in Washington; Editing by Lincoln Feast)