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.

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 Robert Gerber of the U.S. bankruptcy court in Manhattan said in the ruling.

(Reporting by Ajay Kamalakaran in Bangalore; Editing by Lincoln Feast)