Ruby Washington/The New York Times

Raymond Craig Brubaker can thank his lawyer’s red hanky, and some aggressive questioning, for his freedom.

Mr. Brubaker, a former broker for Deutsche Bank in Dallas, spent two and a half months on trial with four other defendants who were accused of marketing fraudulent tax shelters over 10 years ending in 2005, generating more than $7 billion in false tax losses.

His four co-defendants were convicted of conspiracy, fraud and tax evasion charges in Federal District Court in Manhattan earlier this week. But Mr. Brubaker, who sold the tax shelters to about 150 Deutsche Bank clients, was acquitted, as his New York lawyer, Barry H. Berke of Kramer Levin Naftalis & Frankel, demonstrated that he was actually a victim of the scheme.

Mr. Berke faced a hurdle in mounting a defense. The government’s star witness was Erwin Mayer, a former partner in the tax practice of the now-defunct law firm of Jenkens & Gilchrist.

Mr. Mayer was indicted in June 2009 with the other defendants in the case. They included Paul M. Daugerdas, the head of the tax practice at Jenkens, and Donna M. Guerin, another partner in the firm’s tax practice, as well as Denis M. Field, the former chief executive of the accounting firm DBO Seidman, and David Parse, another former Deutsche Bank broker. Those four were convicted on Tuesday.

But Mr. Mayer made a deal to avoid prosecution before the trial, becoming a prosecution witness in a plea bargain. That was important because, for many years, Mr. Mayer was Mr. Brubaker’s primary contact on these tax strategies.

And on the witness stand, Mr. Meyer was going to say that “it was a sham and illegal and he believed that our client had the same view and knowledge,” Mr. Berke said. “We saw that as both a challenge and an opportunity.”

Mr. Berke is a rising star in the white-collar defense, whose array of clients has included Bear Stearns; the owners of the 1933 Double Eagle gold coin, the rare coin that President Franklin D. Roosevelt ordered melted during the 1930s bank crisis; and professional boxers and promoters. At this trial, Mr. Berke used a prop to seize the opportunity: his red hanky.

His cross-examination of Mr. Mayer lasted four days. On the first day, Mr. Berke showed the witness the red handkerchief and asked him to role-play with him. When the hanky went into the lawyer’s breast pocket, the witness was to answer questions as if responding to a potential client, a real estate developer, back in the days when the Jenkens law firm was pitching these tax shelters.

“He fought me at first,” Mr. Berke said. Mr. Mayer said he would have told the potential client that the tax shelters could work, but do not really work. Upon hearing these kinds of answers, Mr. Berke would pull the red hanky out of his pocket and become a lawyer again: “That’s not what you said at all, because you would not have persuaded these hundreds of people and their lawyers and their accountants and financial planners. You had a pitch you sold them. Tell me what your pitch was.”

Eventually, it clicked. The witness began to sell Mr. Berke — and the jury — on how these tax strategies worked and why people like Ted Turner had done these transactions. “This was the government’s star witness sitting there, very persuasively, very eloquently, describing why these transactions worked — exactly the opposite of what he said in his direct testimony for the government,” Mr. Berke said. Ultimately, Mr. Mayer admitted this was the exact pitch he gave to Mr. Brubaker, “though he never shared with Brubaker his secret doubt that these didn’t work.”

Mr. Berke calls this a “key moment” in the trial, when the jury began to see his client in a different light, “as someone who was led to believe that these transactions worked, just like the taxpayers the prosecution was calling as witnesses.”

The prosecution, in its opening and throughout the trial, had emphasized that Mr. Brubaker was a lawyer and certified public accountant, but Mr. Berke countered that his client had gone to law school 20 years ago, but had never practiced law.

With every witness whose testimony touched on Mr. Brubaker’s role in the scheme, Mr. Berke and his co-counsel, Paul H. Schoeman, returned to the theme that their client was acting in good faith in these tax shelters at the time they were marketed.

The government called five former clients of Mr. Brubaker, and on cross-examination, the defense showed them documents dating back more than 10 years, prompting them to recall that contrary to their testimony for the prosecution, they in fact believed these tax strategies were not merely for tax savings, but an investment. They recalled talking with Mr. Brubaker about “how to make money in doing this investment as part of the tax strategy,” Mr. Berke said.

The trial made use of large screens and computer technology, and in his closing argument, Mr. Berke showed more than two dozen witnesses on the screen who could have been called by the prosecution to testify against Mr. Brubaker, among them his colleagues from the Dallas office of Deutsche Bank. With each screen, the witnesses kept disappearing, until only one flashed on the screen: Mr. Mayer, described as “witness who makes deal to avoid jail and keep $3 million.”

In the end, the prosecution’s case was not enough to convince the jury of eight women and four men that Mr. Brubaker was guilty.

Mr. Berke spoke with Mr. Brubaker the day after the verdict, who told him that this was the first in seven years, since the Internal Revenue Service began an investigation, that he was still asleep when the alarm clock rang. After all, if Mr. Brubaker had been convicted on all nine counts, he faced up to 70 years in prison.