When the Federal Reserve helped plan a bailout in 1998 of Long Term Capital Management, the hedge fund, Bear Stearns proudly refused to join the effort. Until recent weeks, Alan “Ace” Greenberg, Bear Stearns’s chairman for more than 20 years and a championship bridge player, still regaled its partners over lengthy lunches about gambling with the firm’s money in its wood-paneled dining room.

The cut-price deal for Bear Stearns reflects deep misgivings about its future and the enormous obligations that JPMorgan is assuming in guaranteeing the firm’s obligations. In an unusual move, the Fed will provide financing for the transaction, including support for as much as $30 billion of Bear Stearns’s “less-liquid assets.”

Wall Street was stunned by the news on Sunday night. “This is like waking up in summer with snow on the ground,” said Ron Geffner, a partner Sadis & Goldberg and a former enforcement lawyer for the Securities and Exchange Commission. “The price is indicative that there were bigger problems at Bear than clients and the public realized.”

The deal followed a weekend of frantic negotiations to save the ailing firm. With the Fed and Treasury Department patched in by conference call from Washington, Bear Stearns executives held the equivalent of a speed-dating auction over the weekend, with prospective bidders holed up in a half dozen conference rooms at its Madison Avenue headquarters. More than 150 JPMorgan employees descended on Bear Stearns to examine the firm’s books and trading accounts.

Even as those talks took place, Bear Stearns simultaneously prepared to file for bankruptcy protection in the event a deal could not be struck, underscoring the severity of its troubles.

On Sunday night, Jamie Dimon, the chief executive of JPMorgan, held a conference call with the heads of major American financial companies to alert them to the deal and allay their concerns about doing business with Bear Stearns.

Image The headquarters of Bear Stearns on Madison Avenue in Manhattan. Credit... Mark Lennihan/Associated Press

“JPMorgan Chase stands behind Bear Stearns,” Mr. Dimon said in a statement. “Bear Stearns’s clients and counterparties should feel secure that JPMorgan is guaranteeing Bear Stearns’s counterparty risk. We welcome their clients, counterparties and employees to our firm, and we are glad to be their partner.” While Bear Stearns toyed with suitors like big private equity firms like the J.C. Flowers & Company, the only meaningful bidder was JPMorgan.