NEW YORK — Harvey Weinstein’s lawyers filed a letter Wednesday asking the judge presiding over his rape trial to recuse himself, on account of “prejudicial and inflammatory” comments he made about the former Hollywood producer using his phone in court the previous day.

Weinstein’s lawyer Arthur Aidala argued that by admonishing Weinstein for his cellphone use, Judge James Burke “created a situation in which the Court’s ‘impartiality might reasonably be questioned,’ in violation of New York State’s Rule of Judicial Conduct.”

“Mr. Weinstein, I could not implore you more not to answer the following question: is this really the way you want to end up in jail for the rest of your life, by texting in violation of a court order? Is it?” Burke told Weinstein.

Weinstein’s lawyers described Burke’s admonishment as “prejudicial and inflammatory” and added that his comments have “virtually gone viral,” as a number of news outlets, including BuzzFeed News, reported on Weinstein breaking the judge’s courtroom rule of no phones.

Aidala writes in his letter that the judge’s comments added to the “unfairly prejudicial negative publicity” his client has faced.

In an email exchange with BuzzFeed News, Weinstein’s publicist, Juda Engelmayer, disputed BuzzFeed News’ report, which quoted Burke saying Weinstein had four phones with him in court. Engelmayer said his client had only two phones.

“The judge was noticeably irate at Mr. Weinstein’s use of his cell phone but also be sure that Harvey didn’t use it with the judge present,” Engelmayer said in an email, adding that Weinstein handed two phones to his attorney and then asked for them back. “To be fair, everyone was using their phones at that point.”

Weinstein’s attorney Donna Rotunno added via email that her client “never had any intention of upsetting the court.”

“This whole scene could have been avoided had the bailiff, who saw his attorneys handing Mr. Weinstein his phones and reported it to the judge prior to his walking in, would have simply advised him then not to use it,” Rotunno said.

The judge’s rules — which are posted outside the courtroom — and announced every few minutes by court officers, clearly bar everyone present from using their phone or other electronic devices. Anyone found doing so is immediately ejected from the room.

The letter was filed after jury selection on the third day of Weinstein’s trial. Of 120 prospective jurors, 50 were dismissed an hour after they entered the courtroom — 47 of them said they had already made up their mind about the case. Two women said they would not be impartial because they had been sexually assaulted in the past, and one said she was close to someone who had “had an encounter with the defendant”.

Earlier in the day, Burke denied a motion from the defense team to bar attorney Gloria Allred — who represents several of Weinstein’s accusers — from the courtroom because she may be called to testify against Weinstein.

Weinstein’s lawyer Damon Cheronis expressed concerns that Allred might relay information from the trial to her witnesses, effectively training or coaching them before they appear on the stand. He added that Allred may be called as an impeachment witness as well.

Lead prosecutor Joan Illuzzi-Orbon objected on behalf of Allred’s team, arguing that the women testifying wanted their lawyer to be present, and that concerns that she would “relay information” were unfounded.

“While I am generally in favor of excluding witnesses from the courtroom, it is possible though not necessary that she may be called for impeachment,” Burke said, adding that he saw no reason to exclude her from the court.

Speaking to reporters Wednesday, Allred said she is pleased with the court’s decision to not bar her from the proceedings.

“If called as a witness, I intend to fully protect my clients right to confidentiality and to communicate with me, which is protected by the attorney–client privilege of confidentiality,” she said.