A New York defense lawyer wasted no time in trying to use President Donald Trump's argument that cooperators, or flippers, in criminal cases "almost ought to be illegal."

Kafahni Nkrumah didn't get very far in his closing argument Thursday when he tried to bring up Trump's statement to disparage a cooperator who was testifying against his client in a drug case. A judge disallowed it, calling the attempt "out of line."

"I am not going to permit you to argue here regarding statements made by the president of the United States in a case that has nothing to do with this one," U.S. District Judge Gregory H. Woods said in a conversation with lawyers outside earshot of the jury.

Trump's remark aired earlier the same day during a "Fox & Friends" interview in which he suggested it should be illegal for people facing prosecution to cooperate with the government in exchange for a reduced sentence.

As for Trump's comment that the decision by those under legal scrutiny to cooperate "almost ought to be illegal," the judge said: "As we all know, and as I am going to instruct the jury, it is not illegal."

Nkrumah's client, Jamal Russell, was eventually convicted on a drug charge and exonerated on a weapons count.

Nkrumah said in an interview Tuesday that he's "no fan of President Trump." But he said the Republican president repeated something a lot of defense lawyers have said for years.

"It's sad to say, but he was right about it," Nkrumah said. "The stakes are so high for some of these cooperators that some are willing to lie."

The courtroom development illustrated the concern of some lawyers that Trump's comments and tweets about the criminal justice system were starting to intrude on actual court cases.

"The president is the leader of the country. What he says can have effect and potentially prejudice trials in lots of different ways," said Carl Tobias, a University of Richmond Law School professor.

In his closing argument, Nkrumah urged jurors to disregard the testimony of a cooperator, saying he lied.

Then, Nkrumah referenced the financial fraud trial of Trump's former campaign chairman, Paul Manafort, which relied in part on cooperating witnesses, saying: "You know what's funny? Yesterday, Manafort was convicted."

Assistant U.S. Attorney Adam S. Hobson objected. The judge immediately called lawyers into a private conversation.

Nkrumah argued, unsuccessfully, that Trump's comments were relevant "because it is concerning cooperators and people's opinions of cooperators. ... I believe that the president's opinion of cooperators is just as pertinent as anyone else's."

After the jury left the room, the judge reiterated that he rejected Trump's opinion because "it is a politically charged, polemic issue that need not be introduced into this case."

Trump went on "Fox & Friends" after his former personal attorney, Michael Cohen, entered a guilty plea to eight felony charges, including violations of campaign finance law for payments made to two women who had alleged affairs with Trump.

Trump told "Fox and Friends" that for "30, 40 years I've been watching flippers. Everything's wonderful and then they get 10 years in jail and they — they flip on whoever the next highest one is, or as high as you can go."

Trump said cooperators "make up things" to get leniency at sentencing and become "a national hero."

A 2016 report by the U.S. Sentencing Commission found that the majority of more than 10,000 federal defendants who received a reduced sentence from 2009 to 2014 for cooperating with the government were used in drug cases.

Annemarie McAvoy, a former Brooklyn federal and state prosecutor, said cooperators were necessities in the American justice system.

"It was inartful at best," she said of Trump's remarks. "I'm hoping it was inartful."