PHOENIX (CN) — Joe Arpaio’s lead defense attorney withdrew from the case for ethical reasons Thursday, three weeks before the former Arizona sheriff’s criminal contempt trial.

Arpaio’s new attorney said in a motion to the court that Arpaio believes he was “coerced” into admitting civil contempt of court in an underlying racial profiling case, and that by doing so he could avoid a charge of criminal contempt.

The Department of Justice announced in October last year that it would pursue a misdemeanor criminal contempt charge against Arpaio, stemming from a 2011 preliminary injunction ordering him to stop immigration patrols that racially targeted Latinos.

Arpaio, a six-term sheriff of Maricopa County, based in Phoenix, has acknowledged his contempt in the underlying racial profiling class action for allowing his deputies to continue to perform the sweeps for 18 months after the federal injunction was imposed.

Mel McDonald, Arpaio’s criminal defense attorney for nearly two years, filed an application with the court on April 3 to withdraw as counsel, citing an ethical rule that signaled his continued representation of Arpaio would violate the rules of professional conduct.

U.S. District Judge Susan Bolton granted McDonald’s request Thursday afternoon after an emergency hearing at which she cleared the courtroom of the public and media.

“It is not public for the specific reasons to be aired because it may involve attorney-client information,” Bolton said.

The withdrawal application gave little detail about McDonald’s concerns, other than to say it was made with “good cause” and that “(p)rofessional considerations require termination of the representation.”

A March 24 filing by Arpaio’s new attorney, Mark Goldman, may shed some light on a possible rift between Arpaio and McDonald. In it, Goldman seeks a “voluntariness hearing” regarding Arpaio’s admission of civil contempt in the racial profiling case.

The motion states that Arpaio “was coerced into making the agreement, and there were improper apparent promises that led him to believe the agreement would avoid the criminal charges he faces.”

Goldman, who joined the case three weeks ago, claims Arpaio “never received the proper assistance of counsel in regard to the agreement because he was never informed that the agreement would leave him open to the criminal charges.”

Arpaio was represented in the civil suit by attorneys with Jones, Skelton & Hochuli. McDonald is a partner at the firm.

After granting McDonald’s motion, Bolton opened the courtroom to the public and denied a pending motion for continuance filed by Goldman.

Goldman sought the continuance because he said the federal government continued to disclose “voluminous documents” to the defense after the court deadline of March 1. Arpaio’s trial is slated for April 25.

“We don’t know what the government disclosed prior to the date that we made an appearance in this case,” Goldman told the court. “We still don’t have all the documents from Jones, Skelton and Hochuli, Mr. McDonald’s law firm.”

John Keller, a Justice Department attorney, said he has provided the defense with copies of all the prosecution’s exhibits.

Goldman has peppered the court with motions since his appearance, including a request to continue the trial by 60 days so he can celebrate his son’s bar mitzvah, and because he has another trial scheduled the week before Arpaio’s.

Bolton denied it. “If Mr. Goldman was unavailable on the trial date or unable to have sufficient time to prepare, he should not have agreed to undertake the representation,” Bolton wrote in denying the motion last week.

“I’d like to see a fair trial for the sheriff,” Goldman told reporters after the hearing.

He said he would “most likely” ask for a delay, and denied that he had any disagreements with McDonald over Arpaio’s representation.

“Mel and I get along just fine,” Goldman said. He did not address his allegation that Arpaio was denied proper counsel during the civil contempt phase of the racial profiling trial.

“The motion speaks for itself and that will be adduced at a voluntariness hearing, if we have one,” Goldman said.

Arpaio, 84, declined to comment after the proceeding. He faces up to six months in jail if convicted.

Arpaio lost his bid for a seventh term in November to Paul Penzone, a Democrat and former Phoenix police sergeant.