PHOENIX (AP) — A former Arizona prosecutor known for winning a conviction in the Jodi Arias murder case agreed Friday to be disbarred in an ethics case in which he was accused of leaking the identity of an Arias juror and sexually harassing female law clerks in his office.

Juan Martinez agreed to give up his license to practice law, ending the ethics case that was scheduled to go to trial in November.

Even though he still disputes the allegations, Martinez said in a court filing that “I no longer desire to defend the charges but wish to consent to disbarment.”

The State Bar of Arizona, which regulates lawyers and was seeking discipline against Martinez, said the outcome was just. Earlier this week, Martinez suffered a defeat when the Arizona Supreme Court reinstated the sexual harassment allegations after a lower court had dismissed them.

In the ethics case, Martinez was accused of leaking the identity of a juror in the Arias case to a blogger with whom he was having a sexual relationship and lying to investigators about it.

The ethics complaint also alleged Martinez would stare at the chests of some female employees in the county prosecutor’s office and look them up and down as they walked away. It said some female employees would hide in the bathroom, duck into cubicles or engage in busy work to avoid encountering Martinez.

Two years ago, Martinez was reprimanded by then-Maricopa County Attorney Bill Montgomery’s office for inappropriate and unprofessional conduct toward female law clerks. Montgomery now serves on the state Supreme Court.

Martinez was fired earlier this year after 32 years as a prosecutor and was appealing his termination.

Martinez didn’t immediately return a phone message seeking comment on the disbarment. His attorney, Donald Wilson Jr., said the disbarment “does not represent an admission of misconduct on his part nor can it be interpreted as an adverse judicial finding as to any of the allegations.”

Earlier this year, Martinez was reprimanded by the state Supreme Court for violating an ethical rule at three other death penalty trials. The court had concluded that Martinez’s efforts to elicit sympathy for victims and fear of defendants, and his failure to follow court rulings had jeopardized the integrity of the legal system.

Arias is serving a life sentence for her first-degree murder conviction in the death of Travis Alexander at his home in the Phoenix suburb of Mesa.

Martinez was criticized for writing a book about the Arias case and for his courtroom tactics, such as disregarding court rulings by repeating questions after a judge had overruled them.

In a sidebar conversation among lawyers and the judge during the Arias trial, Martinez profanely told one of the defense attorneys that if he was married to her, he’d kill himself. He apologized after an objection was made.