That would suggest Mr. Trump willingly left sometime around 2006, the year that revenues peaked in Atlantic City and that Pennsylvania allowed its first casino to open, a development that marked the start of a rapid downward spiral in the city. The drop-off was exacerbated by the recession that began in 2008.

But in early 2009, as Trump casinos lurched toward bankruptcy for the fourth time, Mr. Trump was still trying to hang on. At loggerheads with board members who had been selected by bondholders after the 2004 bankruptcy, he offered to buy all or a part of the casino company bearing his name. He was rebuffed, and he quit the board soon after.

Testifying in bankruptcy court in Camden, N.J., Mr. Trump argued that the company could not use his name, since shortly before filing the bankruptcy it had stopped paying him the $166,000 a month he received under the services agreement. He testified that his brand was worth $3 billion. He also testified that he was personally negotiating the settlement of a lawsuit in Florida that would yield more than $100 million for the company.

And contradicting what he had said after the prior bankruptcy, he testified that the company’s debt load was still too high.

“This time, the debt is being cut by a lot, and the company is really poised,” he said.

There were odd moments on the stand. Mr. Trump, for example, vastly understated his role, saying he “became very much less involved with the company” during years when he was actually chairman of the board and chief executive, and “was on the board in a very minority position” during years when he had been chairman.

As in previous cases, others warned that Mr. Trump’s promises should not be trusted. This time it was Carl C. Icahn, the activist investor who had a major stake in the company. (The two men now describe themselves as friends and Mr. Icahn supports Mr. Trump’s candidacy.)

Mr. Icahn’s team argued that the remaining debt was still unsupportable, that the Trump name was replaceable, and that a windfall from the Florida lawsuit was wishful thinking. Under Mr. Trump, the company had a long history of making rosy revenue projections and never meeting them, Mr. Icahn’s lawyer argued.