Just before FTX collapsed in November, one of its outside lawyers at the law firm Sullivan & Cromwell emailed a colleague at another firm, insisting that the cryptocurrency exchange’s finances were stable.

Rumors of FTX’s demise were “silliness,” the lawyer, Andrew Dietderich, wrote. “FTX is rock solid, doesn’t use customer funds or take credit risk at all,” he said.

Four days later, FTX filed for bankruptcy. Mr. Dietderich quickly arranged for Sam Bankman-Fried, the exchange’s founder, to step down so that a new chief executive, John Jay Ray III, a specialist in corporate turnarounds, could lead the company. When Mr. Ray needed lawyers to manage the bankruptcy, a lucrative assignment, he asked a judge to appoint the same ones who had helped get him the job: Sullivan & Cromwell.

Now, with Mr. Bankman-Fried set to go on trial next month on fraud charges stemming from FTX’s failure, Sullivan & Cromwell’s tangled history with the exchange is drawing scrutiny — especially from Mr. Bankman-Fried’s lawyers and family.

For months, Mr. Bankman-Fried has attacked Sullivan & Cromwell in court papers and on social media, arguing that the firm’s lawyers set him up as the fall guy for FTX’s implosion while downplaying their own involvement with the exchange. The dispute became even more personal this week when FTX sued Mr. Bankman-Fried’s parents, seeking to claw back millions of dollars and claiming the exchange had operated like a “family business.”

Criticism of Sullivan & Cromwell has become more widespread recently, as the firm has racked up over $100 million in legal fees from FTX’s bankruptcy. This summer, its lawyers clashed with representatives for FTX’s millions of disgruntled creditors over the firm’s legal strategy and the pace of its efforts to recover billions in missing assets.

“They were involved before the bankruptcy,” said Sunil Kavuri, an FTX creditor who lost more than $2 million in the collapse. “They should’ve been aware of what was going on.”

The dispute over Sullivan & Cromwell’s relationship with FTX shows the range of powerful institutions that were eager to help Mr. Bankman-Fried during his rapid rise, even as he resisted basic due diligence and eschewed traditional corporate governance. And it offers a preview of a conflict that may unfold at Mr. Bankman-Fried’s trial in Manhattan, where he is expected to shift some of the blame for FTX’s bankruptcy to Sullivan & Cromwell and a second law firm that advised him, Fenwick & West.

In court filings, Mr. Bankman-Fried’s lawyers have suggested that they may raise a so-called advice of counsel defense to argue that those firms approved many of FTX’s actions. Prosecutors have argued that the judge overseeing the trial should not permit Mr. Bankman-Fried to blame his lawyers, because the founder often lied about how his business was using its money. They also said he should have to disclose whether he relied on legal advice from his parents, who are longtime Stanford law professors.

A spokesman for FTX said Mr. Bankman-Fried’s claims were “a biased story line” intended to unfairly blame the professionals trying to recover money. A representative for Sullivan & Cromwell declined to comment. In court, the law firm has said that FTX was never a “regular client,” and that the firm had put in place procedures to guard against conflicts of interest during the bankruptcy.

A spokesman for Mr. Bankman-Fried declined to comment. The FTX founder has pleaded not guilty to charges that he orchestrated a scheme to funnel billions in customer money into venture investments, real estate purchases and political donations. His trial is scheduled to begin on Oct. 3.

One of the oldest law firms in New York, Sullivan & Cromwell began handling legal matters for FTX in summer 2021 after one of its partners, Ryne Miller, was hired as general counsel of FTX.US, the exchange’s American arm.

Over the next year and a half, the firm worked on 20 legal matters for FTX and its sister hedge fund, Alameda Research, court records show, including discussions with federal regulators at the Commodity Futures Trading Commission. Sullivan & Cromwell received a total of about $8.5 million for the work.

Mr. Bankman-Fried has said that beyond those specific matters, he worked out of Sullivan & Cromwell’s offices in New York while visiting from FTX’s Bahamas headquarters. And when FTX started teetering in November, Mr. Dietderich emailed a lawyer working on the bankruptcy of Voyager Digital, a crypto firm that FTX was trying to acquire, to assure him that the exchange “doesn’t lend” its customers’ money.

It turned out he was wrong. As FTX plunged into crisis the next day, Mr. Miller sought a $4 million retainer for Sullivan & Cromwell so the firm could work on a possible bankruptcy filing, according to messages he sent at the time. Soon, Sullivan & Cromwell lawyers alerted the authorities to possible criminal malfeasance at FTX, while Mr. Dietderich encouraged Mr. Bankman-Fried to let Mr. Ray take over the exchange.

In essence, Sullivan & Cromwell worked both sides of the crisis. When FTX was a darling of the corporate and political elite, the firm’s lawyers helped Mr. Bankman-Fried navigate Washington as he pushed to loosen regulations. After FTX failed, Sullivan & Cromwell worked closely with federal prosectors, supplying them with key corporate records.

In January, the U.S. trustee assigned to FTX’s bankruptcy raised the prospect of removing Sullivan & Cromwell from the case, citing its failure to disclose all of its past work for FTX. Around the same time, four U.S. senators released a letter arguing that Sullivan & Cromwell had a conflict of interest because the firm might bear some responsibility for FTX’s failure. But the trustee backed down after the firm made a more detailed disclosure, and a judge allowed the lawyers to continue overseeing the bankruptcy, saying he saw “no evidence of any actual conflict.”

Mr. Bankman-Fried has remained fixated on Sullivan & Cromwell. His lawyers have argued that the firm is providing evidence to the prosecutors that reflects poorly on Mr. Bankman-Fried, while withholding material that could help the defense. Prosecutors have denied that claim, writing in court papers that FTX and its lawyers “have been responding to the government’s document requests voluntarily.”

After Mr. Bankman-Fried’s arrest, his mother, Barbara Fried, contacted one of her Stanford colleagues, the legal ethics scholar Bill Simon, and asked him to evaluate Sullivan & Cromwell’s conduct in the bankruptcy. Mr. Simon, a family friend, spent about nine hours discussing the case with Mr. Bankman-Fried in June, he said in an interview, before writing an unpublished article criticizing the firm, which he shared with The New York Times.

“It is hard to see how the lawyers could have done their jobs during the period in which they represented FTX,” he wrote, without familiarizing themselves with practices that “are now condemned as irresponsible or worse.”

Rebecca Roiphe, a former prosecutor and a professor at New York Law School, said it was fair to raise questions about potential conflicts of interest when a law firm represented a company both before and during a government investigation that might involve related work.

“But this is not uncommon and doesn’t necessarily prove wrongdoing,” she said, adding that Mr. Simon had asked her to review his article.

At the same time that Sullivan & Cromwell has clashed with Mr. Bankman-Fried, the firm has faced pushback from FTX’s creditors. They have complained that the law firm has failed to maximize proceeds from the sale of the exchange’s assets. So far, the lawyers say they have recovered about $7 billion, but it’s unclear how much of that will be returned to customers, who have filed $16 billion in claims, court filings show.

The dispute spilled into public in July when a group appointed to represent FTX’s creditors in the case said Sullivan & Cromwell had ignored its suggestions about how to resolve the bankruptcy. The law firm responded that some creditors were engaging in “unprofessional conduct” — the lawyers had been left perturbed after a meeting in which at least one creditor used a four-letter word to express frustration, two people familiar with the exchange said.

None of those conflicts have stemmed the flow of payments to Sullivan & Cromwell, which has more than 200 lawyers, paralegals and support staff members working on FTX’s bankruptcy, the most senior of whom charge $2,165 an hour.

In its most recent monthly bill, Sullivan & Cromwell said it was owed more than $10 million for its work on the bankruptcy, including over 100 charges for meetings, calls or correspondence with the federal prosecutors pursuing Mr. Bankman-Fried.