By Jacques Billeaud and Ryan Van Velzer

Associated Press

PHOENIX — Sheriff Joe Arpaio has remained politically invincible in his 22 years in office in Arizona, despite federal investigations and a history of legal woes that have cost taxpayers tens of millions of dollars.

But his latest entanglement in the courts is his toughest test yet after he acknowledged to a judge presiding over his racial-profiling case that his office was behind a secret investigation into the judge's wife.

Protestors of U.S. Immigration and Customs Enforcement (ICE) agents working with Maricopa County Sheriff Joe Arpaio, gather, Thursday, April 23. (AP Image)

The disclosure came as Arpaio testified in a contempt of court hearing convened after he admitted disobeying the judge's order to stop his signature immigration patrols as part of the profiling lawsuit.

The revelation has raised questions about whether Arpaio can win a seventh term next year.

David Berman, a senior research fellow at Arizona State University's Morrison Institute for Public Policy, said the upcoming election represents the most likely possibility yet that the sheriff could get voted out of office.

Still, Berman cautioned that Arpaio has repeatedly defied predictions over the years that his legal troubles would cost him his job.

"I don't know if blowing off the court would be such a sin in the eyes of voters as much as going after the judge's wife with a private investigator," Berman said. "That's something people can relate to."

Under questioning Thursday by U.S. District Judge Murray Snow, Arpaio said he believed his then-attorney had hired a private investigator to investigate the judge's wife for purportedly making a comment that about the judge not wanting the sheriff to get re-elected in 2012.

Arpaio's second-in-command, Jerry Sheridan, testified Friday at the contempt hearing that an interview was conducted of the woman who provided the tip to the sheriff about the judge's wife, but the investigation didn't go any further.

The hearing ended late Friday and it's unknown when the judge will rule in the contempt case. Snow has raised the possibility of holding more contempt hearings in June.

It was not immediately clear what consequences Arpaio might face over the secret investigation. Federal law prohibits trying to intimidate or inappropriately influence a federal judge.

The U.S. Attorney's Office and FBI didn't immediately respond Friday to questions about whether the agencies are examining Arpaio's disclosure that his office was behind the investigation of the judge's wife.

The sheriff's political strength has been gradually declining over the past four election cycles, but his base of devoted supporters and impressive fundraising have helped him pull out wins.

He spent $8 million to win his 2012 re-election — nearly 14 times as much as his closest competitor spent and as much as Arizona's governor spent to gain office last year.

Tough immigration efforts previously fueled Arpaio's political contributions from across the country, but pressure from Washington and the courts brought an end to his tactics.

No one has publicly declared a challenge to Arpaio next year. His last campaign finance report says he has $2 million in campaign money on hand.

The bravado the sheriff is known for displaying on TV and at political events was missing during his testimony before Snow, who launched the contempt case against Arpaio for violating the 2011 order to halt the immigration patrols.

Arpaio has acknowledged the contempt violations and offered to make a $100,000 donation from his own pocket to a civil rights group to atone for the problems that he maintains weren't intentional.

Outside court, Arpaio said he was confident about his chances next year.

"All I'm going to tell you is that I've been elected six times," Arpaio said. "I expect this to be No. 7."

Alfredo Gutierrez, a former Democratic state senator and longtime Arpaio critic who attended the contempt hearings, doubts the sheriff can get re-elected, explaining the severity of the investigation into the judge's wife sets it apart from other scandals faced by Arpaio.

Tom Morrissey, a retired chief U.S. marshal and a longtime Arpaio friend who regularly has lunch with the sheriff, noted that no GOP politicians are speaking up on behalf of the Republican sheriff. Still, Morrissey predicted his buddy will win a seventh term.

"He has a lot of support of the people here," said Morrissey, a former Arizona Republican Party leader.

Arpaio has a long history of investigating his opponents. Two elected county supervisors and a judge were among those investigated and charged with crimes in the past decade after feuding with the sheriff's office.

Those officials said the allegations were trumped up. The investigations failed, leading the county to pay some of them seven-figure settlements.

A federal grand jury conducted a nearly three-year investigation of Arpaio's office on criminal abuse-of-power allegations. The investigation was closed in 2012 without any charges being filed.

The disclosure about the investigation into the judge's wife also raises questions about whether the sheriff might seek the removal of Snow from the case.

Charles Gardner Geyh, a law professor at Indiana University with an expertise in judicial ethics, said he wasn't able to comment on the specifics of Arpaio's case but said generally that a defendant trying to get a judge taken off a case would have to show the court was biased or impartial.

But adverse rulings aren't enough to get a judge removed, Geyh said.

"The idea that a party could control his own fate in a way that escapes justice is not going to be tolerated," he said.

Copyright 2015 The Associated Press