Most of all, Mr. Boies said, he felt misunderstood. While he concedes he made mistakes, he maintains he was simply defending his clients’ interests to the best of his abilities, including protecting them from damaging headlines.

“You don’t know all the facts when you take on a client,” he said, “but once you do, you have a duty of loyalty. You can’t represent them halfway. If, as a lawyer, you start to value how you are going to look to the media, as opposed to how your client will look, then you should find a new profession.”

A bedrock of lawful society is that every defendant, no matter how repugnant, has the right to a zealous attorney. But — as he himself has put it — that doesn’t mean the right to David Boies. He can afford to be selective about whom he represents, and he told me that he accepts as clients fewer than 20 percent of the people who approach him.

Throughout his half-century of practice, Mr. Boies has shown an almost unerring instinct for picking clients who burnish his reputation. It has made him one of the highest-paid lawyers in the country, with an hourly rate of $1,850. And it has baffled legal observers that, in what could have been his gilded years, Mr. Boies ended up representing both Mr. Weinstein and Theranos, led by Elizabeth Holmes, in ways that arguably helped prolong their misdeeds. For the first time in his career, the most vaunted advocate in the United States has been a defendant in the court of public opinion.

‘The Golden Boy’

One afternoon in August, Mr. Boies occupied a prime corner table at the newly reopened Four Seasons restaurant in Manhattan. It was his third meal there in 36 hours. With tousled dark-blond hair and a rather slight build, he looked tanned and relaxed and was looking forward to a safari in Kenya. He was drinking a glass of cabernet from the vineyard he owns in Northern California, visibly relieved that he could again indulge his craving for the Four Seasons version of pigs in blankets.

From his vantage, any clouds over his reputation had dissipated. His firm, Boies Schiller Flexner, was thriving, and he was in demand. In just the first six months of this year, he had generated $35 million in billings. A lawyer for Leslie Moonves, who in early September was forced out as CBS’s chief executive after allegations of sexually aggressive behavior, recently approached Mr. Boies to see if he’d consider representing Mr. Moonves. Mr. Boies demurred, saying, “I don’t think that would be good for Les, and I don’t think that would be good for me.”

Although he’s a Democrat, Mr. Boies said he’d be more than happy to represent President Trump in the investigation by Robert S. Mueller III, the special counsel. “Whether you agree with him or not, he needs to have effective representation,” Mr. Boies said of the president. “This long, drawn-out morality play isn’t in the country’s best interests. It needs to be resolved. Of course, he’d have to agree to do what I told him.”