Harvey Weinstein’s bail was increased from $1 million to $5 million on Wednesday over allegations he violated bail conditions by mishandling his electronic ankle monitor.

But Judge James Burke rejected prosecution calls to put the disgraced movie mogul in jail over the alleged violation.

Weinstein, 67, arrived at court in the morning using a walker, and his lawyer said he will be undergoing back surgery on Thursday. In his last court appearance, he hobbled into court and looked more pained than usual.

On Wednesday, Burke warned that he would revoke his bail and issue a warrant for his arrest if other issues crop up.

HARVEY WEINSTEIN DOCUMENTARY 'UNTOUCHABLE' COMING TO HULU

“If you have any further medical issues, the court will not be terribly understanding,” Burke said.

Harvey Weinstein, center, arrives for a court hearing, Wednesday, Dec. 11, 2019 in New York. (AP Photo/Mark Lennihan)

Weinstein was calm and respectful during the hearing and indicated that the surgery would help ensure his appearance at his trial. The disgraced movie mogul is scheduled to stand trial in New York City beginning Jan. 6 on rape and sexual assault charges.

“As it was made clear in court today, Mr. Weinstein is looking forward to Jan. 6,“ said Weinstein's lawyer, Donna Rotunno.

Weinstein has pleaded not guilty to charges he raped a woman in a Manhattan hotel room in 2013 and performed a forcible sex act on a different woman in 2006. He had been free on $1 million bail and maintains that any sexual activity was consensual.

HARVEY WEINSTEIN'S SEXUAL MISCONDUCT ALLEGATIONS: A TIMELINE OF EVENTS

For the new bail, Weinstein's defense team chose an option that lets him meet the obligation by putting up $2 million through a bail bondsman — that option was available because of the recent changes to bail rules in New York. That amount includes the $1 million he had already put up for bail.

Prosecutor Joan Illuzzi said at a hearing Friday that Weinstein has repeatedly, purposely left at home a piece of the monitoring technology that keeps the ankle bracelet activated.

That has left his whereabouts unrecorded for hours at a time, she said.

Rotunno has denied it was anything deliberate, blaming “technical glitches” like dead batteries and said it had nothing to do with manipulation of the bracelet, though she acknowledged that on at least one occasion, he’d forgotten part of the device at house.

HARVEY WEINSTEIN'S LAWYERS AFTER HIM FOR NEARLY $500G

But on Wednesday, Illuzzi told the court that the person monitoring Weinstein does not believe the problems due to were technical glitches. While the monitoring now appears to be working, Illuzzi said she thought that was because of the threat of new bail.

“I don't think it was the adding of the extra batteries,” Illuzzi said. “It was Mr. Weinstein’s panic that the court might change the bail.”

After the hearing, Rotunno countered that.

CLICK HERE TO GET THE FOX NEWS APP

“There were no violations. These were technical issues related to a battery," she said. "Ms. Illuzzi makes mountains out of mole hills.”

In recent months, Weinstein has been spotted hobnobbing at New York City nightclubs and getting jeered at a recent actors showcase.

The Associated Press contributed to this report.