Former US President Donald Trump has clashed repeatedly with the judge while testifying at a New York civil fraud trial that threatens his family’s business empire.
An exasperated Judge Arthur Engoron told Mr Trump the hearing in Manhattan was not a political rally.
New York’s attorney general is seeking a $250m (£202m) fine and severe restrictions on the family business.
Judge Engoron has already ruled the Trump Organization committed fraud.
Prosecutors allege that Mr Trump, his adult sons Eric and Donald Jr and other Trump Organization executives inflated company assets to secure favourable loans.
The trial will determine the penalties they will face.
In court on Monday, prosecutors began by questioning Mr Trump about his company, where its assets are held and about the valuation of its properties.
Mr Trump responded at times with lengthy remarks about the real estate and why he invested in it, prompting rebukes from Judge Engoron.
At one point, the judge said: “Please just answer the questions, no speeches.
“Some of your answers have not been responsive to the questions.”
Mr Trump later told the court: “I’m sure the judge will rule against me because he always rules against me.”
Judge Engoron fired back: “You can attack me, whatever you want, just answer the questions.”
The tone became more fractious as the judge asked Mr Trump’s lawyer, Christopher Kise: “Mr Kise, can you control your client? This is not a political rally, this is a courtroom.”
“I beseech you to control him,” the judge added. “If you can’t, I will.”
Later on, Mr Kise said that with Mr Trump “it’s far more efficient to listen and take it all in” – prompting laughter from a lawyer on the attorney general’s team.
Judge Engoron’s voice rose as he said: “No, I’m not here to hear what he has to say. I’m here to hear him answer questions.”
Like his two sons in their testimony last week, Mr Trump said it was the Trump Organization accountants who bore responsibility for the financial reports.
“All I did was authorise and give people whatever was necessary for the accountants to do the statement,” Mr Trump said.
He also rebutted allegations that the company’s properties were overvalued.
Mr Trump instead argued they were in fact undervalued.
He said his Mar-a-Lago resort in Florida and some of his golf courses were worth more than he had claimed and had been bolstered by his personal brand.
Renato Mariotti, a former federal prosecutor, told the BBC he believes Mr Trump’s aggressive responses indicate his legal team believes “they’ve already lost”.
“They’re trying to spin or add some colour to a very bad result,” Mr Mariotti added.
Mr Mariotti added that while it would be a legally safer strategy for Mr Trump to invoke his right under the Fifth Amendment of the US Constitution and decline to answer questions, efforts at “distraction” were more likely.
“He’s focused on provoking a fight with the judge,” he said. “None of that helps, from a legal perspective.”
Mr Trump last appeared in court at the end of October to watch the testimony of his former attorney, Michael Cohen, a star witness in the case against him.
The former president’s daughter, Ivanka, is expected to testify on Wednesday. She is no longer listed as a co-defendant in the case.
The civil case in New York is one of several legal battles in which Mr Trump is embroiled.
He also faces three criminal indictments over his alleged efforts to overturn the results of the 2020 election, his handling of classified documents and another alleging false accounting involving hush money.