Donald Trump clashed with the judge in his New York civil fraud trial on Monday, with the judge threatening to cut off his testimony.
Under questioning about his company's accounting practices, Mr Trump repeatedly clashed with Judge Arthur Engoron, who is weighing whether to impose hundreds of millions of dollars in fines.
Judge Engoron warned the former US President that he might remove him from the witness stand if he did not answer questions directly.
“Mr Kise, can you control your client?" he asked Trump's lawyer, Christopher Kise. “This is not a political rally. This is a courtroom.”
Mr Trump is facing questions over whether the Trump Organization engaged in questionable accounting practices to obtain favourable loans and deals.
New York state lawyers argue that these methods may have inflated his wealth by $2bn (£1.6bn), and earned him $100m (£81m).
Mr Trump acknowledged that his company did not provide accurate estimates of the value of apartment towers, golf courses and other assets, but argued it wasn’t important as banks did not take the estimations seriously.
“It wasn't important. You’ve made it important, but it wasn’t," Mr Trump said of the estimates.
Mr Trump has repeatedly called the case a "witch hunt" and has accused the judge and New York Attorney General Letitia James, who brought the case, of political bias.
On the witness stand, he accused legal authorities of paying unduly close attention to his business after he won the 2016 presidential election.
“I’m sure the judge will rule against me because he always rules against me," he said, adding: “This is a very unfair trial."
At one point when Mr Trump was on the stand, the judge asked his lawyers to take him to the back of the courtroom and “explain the rules."
“The former and again soon to be president of the United States understands the rules," Mr Kise responded.
Mr Trump is the Republican party’s frontrunner for the nomination for the 2024 presidency.
New York Attorney General Letitia James brushed aside any accusations of a witch-hunt, telling media outside the courthouse: “At the end of the day, the only thing that matters are the facts and the numbers. The numbers, my friends, don't lie.”
Unlike the four criminal cases Mr Trump faces, this civil trial does not threaten to put him in prison as he mounts a bid to take back the White House.
Ms James is seeking $250 million in fines, as well as restrictions that would prevent Mr Trump and his sons Eric and Donald Jr from doing business in New York.
Judge Engoron has already cancelled business certificates for companies that control large portions of his business, though that order is on hold during appeal.
The judge also twice fined Trump a total of $15,000 for violating a gag order which prevents him from criticising court staff.
His campaign has used the fraud trial as a fundraising opportunity, telling loyal supporters that he is defending his family from “corrupt” New York Democrats.
The trial was originally scheduled to run through early December but could wrap up sooner as the state calls its final witnesses this week. It is unclear how many witnesses the defence will call.
Mr Trump's daughter Ivanka is also due to testify on Wednesday, though she is not a defendant in the case.