Former President Donald Trump was playing to two audiences yesterday in a Manhattan courtroom: the court of public opinion and the court of appeals.

His repeated clashes with Judge Arthur Engoron, who Trump criticized to his face, were not aimed at changing his mind as he has already found Trump and his company guilty of fraud – and there's no jury.

What the former president was doing was using his day on the stand as part of his campaign.

The more he tangled with the judge, the more he was trying to create grounds for a successful appeal. Trump and his team know Engoron is not a fan, and the only thing at stake in this trial is the degree of financial punishment for the Trump Organization.

LEGAL EXPERTS SAY WHETHER TRUMP'S COURT TESTIMONY IN NY HELPED OR HURT HIS CASE

Trump speaks outside NY court

Former President Donald Trump speaks to members of the media after testifying at his civil fraud trial at the New York State Supreme Court on Nov. 6 in New York City. (Michael M. Santiago/Getty Images)

He was also baiting the judge because his supporters love when he takes on a court system that they view as blatantly biased against him. His dogged defiance (with $15,000 in fines to show for it) fuels the perception of him as a candidate who can tame a crooked system.

The defendant took his first shot before the trial began, telling reporters that "while Israel is being attacked, while trade is being attacked, while inflation is eating our country alive, I’m down here." Citing a New York Times poll that has him leading President Biden in five swing states, he said: "This is really election interference."

Trump also called New York Attorney General Letitia James a "racist," who made her own brief appearance at the mics and said the case would be decided on "facts" and "the numbers don’t lie."

At one point Trump testified: "This is a very unfair trial. Very, very. And I hope the public is watching," though there are no cameras airing the trial and everything is filtered through reporters’ accounts.

TRUMP DEMANDS JURY, SAYS NEW YORK AG HAS 'NO CASE' IN HEATED TESTIMONY

The gist of Trump’s testimony was to minimize the importance of the real estate valuations that his company gave banks and insurance firms, which the prosecution says were inflated. 

"I would look at them, I would see them, and I would maybe on occasion have some suggestions," Trump said, citing the case of his Seven Springs golf course north of Manhattan, the estimate of which was dropped after Trump said it was overvalued.

He declared that "everybody" in the organization was keeping the statements honest and that sometimes "I would hear things" about fraud and take care of it.

Trump, who’s an experienced witness, tended to ramble on the stand, at one point going on about the beauty of his golf course in Scotland. 

"Irrelevant, irrelevant, answer the question," Engoron said.

The judge repeatedly told Trump to shorten his answers, in one instance striking his remarks from the record and saying: "This is not a political rally."

One setback came as the former president conceded that his Trump Tower triplex was actually 11,000 square feet, not 30,000 as he had claimed, suggesting that the elevator shafts might have been mistakenly counted. Remember, he built the building.

Chris Kise, attorney for former President Donald Trump, right, exits New York State Supreme Court in New York

Chris Kise, attorney for former President Donald Trump, right, exits the New York State Supreme Court on Monday, Nov. 6. (Jeenah Moon/Bloomberg via Getty Images)

Trump also made the familiar argument that Mar-a-Lago was absurdly undervalued, but that he did not challenge it. He also said the Trump brand added value to any property.

When Trump insisted on the importance of a disclaimer in the valuations telling banks and insurers that the numbers were estimates and they could do their own research, Engoron said: "If you want to know about the disclaimer clause, read my opinion again. Or for the first time, perhaps." 

Everyone noticed the jab.

Perhaps the greatest clash came when the judge threatened to kick Trump off the witness stand.

THE SCOURGE OF ANTISEMITISM IS NOW GLOBAL AND INESCAPABLE

Engoron told one of Trump’s lawyers, Christopher Kise, to rein in his client. 

"I beseech you to control him if I can’t," Engoron said. "If you can’t, I will excuse him and draw any negative inference that I can." 

That means – and this is often a jury instruction – that he can conclude that Trump was dodging the question and hold that against him.

Toward the end of his testimony – the defense chose not to cross-examine him – Trump called the trial a "disgrace" and told the AG’s lawyer "you should be ashamed of yourself." 

The judge clearly has disdain for Trump, at one point calling him a "broken record." He has ruled against him at every turn. He will probably hit the Trump Organization with severe penalties, which could include barring it from doing business in the state of New York.

Former President Trump

Former President Donald Trump exits the courtroom after testifying at his civil fraud trial at New York State Supreme Court on Nov. 6 in New York City. (Michael M. Santiago/Getty Images)

Trump and his legal team know all that. That’s why he took such a combative stance. It’s all about playing for the appeal and playing to the crowd. 

Trump gave his final word after five hours of testimony, telling reporters, "It’s a scam. This is a case that should have never been brought, and it’s a case that should be dismissed," describing it as "a very sad day for America."

Next was Letitia James, who said: "He rambled, he hurled insults, but we expected that … Justice will prevail."

CLICK HERE TO GET THE FOX NEWS APP

The impact would have been 100 times greater if the trial had been televised, which would violate New York law. When the proceedings got under way, the cable networks kept showing over and over Trump sitting at the defense table during the minute that cameras were allowed to record.

So the public will be getting its trial news the old-fashioned way – from the press, with whom Trump has such a love-hate relationship.