Harvey Weinstein's lawyer has asked the judge in his client's rape case to step down after he threatened to jail Mr Weinstein for using his phone in court.
Arthur Aidala said Judge James Burke's "inflammatory, biased and prejudicial" comments suggested he had already decided Mr Weinstein was guilty.
Mr Weinstein faces five charges and possibly life in prison if convicted.
The allegations include rape and predatory sexual assault relating to two unnamed accusers.
He is charged in the New York City court with raping one woman in a Manhattan hotel room in 2013, and performing a forcible sex act on the second woman in 2006.
The 67-year-old has denied all charges and insists any sexual encounters were consensual.
What is in the lawyer's letter to the judge?
It referred to Judge Burke scolding the former Hollywood producer on Tuesday.
"Is this really the way you want to end up in jail for the rest of your life, by texting and violating a court order?" Judge Burke asked.
Mr Weinstein shook his head and denied that he had used his phone.
"These comments reflect the court's animus towards the defendant and have created a situation in which the court's 'impartiality might reasonably be questioned'," Mr Aidala wrote.
Mr Aidala contended that the judge's rebuke suggested either that using a phone in court merited a life sentence or that the court "already knew it intended to sentence him to life in prison".
"It is without question that damage has been done to the appearance of fairness in this trial," he said.
Mr Weinstein was caught using two mobile phones on Tuesday, according to local media. He had already been admonished by Judge Burke at previous court appearances for using a handset.
Mr Aidala said he would call for the trial to be postponed if a new judge was not brought in.
Judge Burke has not yet responded.
On Monday, Mr Weinstein was charged with an additional two counts in Los Angeles: rape and sexual assault.
Mr Aidala argued that the jury pool had been tarnished by the extensive press coverage of the Los Angeles charges filed on Monday. In the letter he said that the indictment's timing was designed to unfairly influence jurors.
Mr Aidala argued that the judge's refusal to push the trial back as a result was further evidence of bias against his client.
On Tuesday, Judge Burke declined to deny Mr Weinstein bail after prosecutors alleged that he was a flight risk. He is out on $5m (£3.8m) bail and is required to wear an electronic tracking device.
After jury selection, Mr Weinstein's New York trial is expected to begin in about two weeks' time.