Judge Arthur Engoron rebuked Donald Trump after the former president attacked his clerk in a social media post on Tuesday and forbade the parties from making any future comments about his staff.
"This morning one of the defendants posted on (a) social media account a disparaging untrue and personally identifying post about a member of my staff. Although I have since ordered the post deleted and apparently it was, it was also emailed out to millions of other recipients," the judge said in court.
"Personal attacks of any member of my court staff are unacceptable, inappropriate and I will not tolerate them," the judge said.
Trump looked straight ahead at the judge as he issued the order.
The judge then said all parties must not speak publicly about any members of the court staff.
"Consider this statement an order forbidding all parties from posting, emailing or speaking publicly about any members of my staff," Engoron said. "Failure to abide by this ... will result in serious sanctions."
Trump posted on Truth Social Tuesday attacking Engoron's clerk, claiming she was a "girlfriend" to Senate Majority Leader Chuck Schumer, a New York Democrat, and showing a picture of the two of them together.
"How disgraceful!" Trump wrote. "This case should be dismissed immediately."
It was not immediately clear there was a connection between Engoron's clerk and Schumer beyond taking a photo. CNN has reached out to Schumer's office for comment.
During the lunch break before the judge's admonishment, there was unusual activity outside the court room, and Trump went in and out during the break. There also was a short delay before court convened for the afternoon session.
For the past two days, Trump has voluntarily attended the New York civil trial, where the New York Attorney General Letitia James has brought a $250 million lawsuit accusing Trump and co-defendants of committing repeated fraud by inflating assets to get better terms on commercial real estate loans and insurance policies.
The New York attorney general is seeking to bar Trump from doing business in the state. Last week, the judge ruled that Trump and his co-defendants were liable for "persistent and repeated" fraud, one of seven claims the attorney general is trying to prove.
Monday, Trump also went after the clerk in his comments outside the courtroom, though he didn't mention her by name.
"And this rogue judge, a Trump hater. The only one that hates Trump more is his associate up there," Trump said. "The person that works with him. She's screaming into his ear almost every time we ask a question. A disgrace. It's a disgrace."
The photo of Schumer and the clerk was posted last week by an obscure account on X, formerly known as Twitter, that had fewer than 200 followers as of Tuesday.
The post, which Trump included as an image in his own Truth Social post, did not allege that the clerk was Schumer's girlfriend, merely that the two were "palling around." Trump added the baseless "girlfriend" claim.
This story has been updated with additional developments.