A hearing to decide whether to hold Maricopa County Sheriff Joe Arpaio in contempt of court for violating court orders in a racial-profiling case took a surprising turn when the lawman acknowledged that his office was behind a secret investigation into the judge's wife.

Judge Murray Snow leveled a series of questions at Arpaio after his testimony wrapped up, focusing primarily on whether he or his family was being investigated by the sheriff.

Arpaio said he believed his former lawyer had hired a private investigator to investigate Snow's wife after she purportedly made a comment about the judge not wanting the sheriff to get re-elected in 2012.

The judge convened the contempt-of-court hearing this week after Arpaio defied his orders to stop carrying out immigration patrols. Snow ruled in 2013 that Arpaio's office had profiled Latinos while conducting illegal-immigration operations.

Arpaio testified under oath that he had come into the possession of an e-mail from a tipster who claimed to have met Snow's wife at a restaurant, The Arizona Republic reported. The e-mail claimed Snow's wife said the judge "wanted to do everything to make sure I'm not elected," according to Arpaio. 

The sheriff said his lawyers then hired a private agent to investigate the matter. 

"Results confirmed that your wife was in that restaurant," Arpaio told Snow, according to the newspaper. "I guess (the investigator) talked to the witness, confirmed that that remark was made."

Click for more from The Arizona Republic   

The Associated Press contributed to this report.