NEW YORK — A bankruptcy judge decided just after midnight Saturday that Lehman Brothers can sell its investment banking and trading businesses to Barclays, the first major step to wind down the nation’s fourth-largest investment bank.
U.S. Bankruptcy Judge James Peck gave his decision in a courtroom packed with lawyers at the end of an eight-hour hearing, which capped a week of financial turmoil.
The deal was said to be worth $1.75 billion earlier in the week but the value was in flux after lawyers announced changes to the terms on Friday. It may now be worth closer to $1.35 billion, which includes the $960 million price tag on Lehman’s Midtown Manhattan office tower.
Lehman Brothers Holdings Inc. filed the biggest bankruptcy in U.S. history Monday, after Barclays PLC declined to buy the investment bank in its entirety.
The British bank will take control of Lehman units that employ about 9,000 employees in the U.S.
‘‘Not only is the sale a good match economically, but it will save the jobs of thousands of employees,’’ said Lehman lawyer Harvey Miller of Weil, Gotshal & Manges.
Barclays took on a potential liability of $2.5 billion to be paid as severance, in case it decides not to keep certain Lehman employees beyond the guaranteed 90 days. But observers have said Barclays’ main reason for acquiring Lehman is to get its people and presence in North America, making widespread layoffs less likely.
‘‘It’s unimaginable to me that they can run the business without people,’’ said Lehman’s financial adviser, Barry Ridings, of Lazard Ltd.
Barclays had little competition to land the deal.
Miller said that before it filed for bankruptcy, Lehman had negotiated with just one other bidder, Bank of America Corp. BofA instead announced Monday that it would buy Merrill Lynch & Co., saving it from a fate similar to Lehman’s. That deal was originally valued at $50 billion.
Miller said that since Lehman filed for bankruptcy, Barclays had been the only buyer to express interest in acquiring even parts of the 158-year-old investment bank.
‘‘The substance of this transaction is to continue a business for the benefit of the economy,’’ Miller said in court.
Lehman lawyers announced a number of changes to the deal before the hearing, which started at 4:30 p.m. Friday and continued well past midnight.
Lehman lawyers said the value of stock Barclays will buy and liabilities it will assume has fallen since the start of the week due to market volatility. Under the new deal, Barclays will buy $47.4 billion in securities and assume $45.5 billion in liabilities.
Barclays also said it would buy three additional units — Lehman Brothers Canada Inc., Argentina-based Lehman Brothers Sudamerica SA and Lehman Brothers Uruguay SA. The two South American entities are part of Lehman’s money management business. Barclays is not paying extra to get the three units.
There was no change to a $250 million goodwill payment and the purchase of two data centers in New Jersey that will go to Barclays, although Barclays may pay less for them. Lehman’s investment management business Neuberger Berman was not bought by Barclays.
The Securities Investor Protection Corp. liquidated Lehman accounts Friday under a bankruptcy-style process to transfer assets from 639,000 Lehman customer accounts — about 130,000 of which are owned by individual investors — to Barclays accounts.
In a statement Saturday, the SIPC, which maintains funds to protect investors’ assets at failed brokerage firms, said Lehman customers ‘‘should have full access to their accounts in very short order.’’
Friday night’s hearing drew more than 200 lawyers and observers, who spilled into overflow rooms on two floors of the U.S. Bankruptcy Court in Lower Manhattan.
In response to the extraordinary events of the week, the Bush administration announced Friday the biggest proposed government intervention in financial markets since the Great Depression. Some are calling it an ‘‘RTC-style bailout’’ in reference to the government-owned Resolution Trust Corp. that wound down the assets of savings and loan associations, mostly in the 1980s.
‘‘Somehow Lehman Brothers gets left on the sidelines,’’ said Daniel Golden of Akin Gump Strauss Hauer & Feld LLP, who represents clients holding about $9 billion in bonds. ‘‘We believe this was a flawed sales process. It benefits Barclays and the federal government but not the creditors of this estate.
‘‘The economic landscape seems to have changed over the last two days,’’ he said. ‘‘Yet the debtors and the Fed seem determined that nothing get in the way of this transaction.’’
Had Lehman filed for Chapter 11 a week later than it had, its fate may have been different.
‘‘This is a tragedy — maybe we missed the RTC by a week,’’ Miller said.
‘‘That occurred to me, as well,’’ the judge said. ‘‘Lehman Brothers became a victim, in effect the only true icon to fall in the tsunami that has befallen the credit markets.’’