PHOENIX (AP) — The sheriff of metro Phoenix has long been known for jailing inmates in tents and pink underwear and cracking down on illegal immigration. But an upcoming trial will force Sheriff Joe Arpaio to answer for a pattern of behavior that his critics have long found deeply troubling.

The U.S. Justice Department is putting Arpaio on trial next month in a civil rights case that will focus in part on how the sheriff investigated and criminally charged people who crossed him from 2007 until 2010.

The cases included officers leading a judge out of his chambers and arresting newspaper executives and protesters who were critical of him. In addition, a county supervisor embroiled in a feud with the lawman was charged with dozens of felonies.

Each of the investigations collapsed, and county taxpayers had to pay $8.7 million in lawsuits to the people who said they were investigated on trumped-up allegations. The Justice Department decided against filing criminal abuse-of-power allegations against Arpaio but went ahead with a civil case that will be heard beginning Aug. 10 in Phoenix.

The case comes as Arpaio is facing legal troubles on several fronts. The courts have stripped him of his powers to conduct the immigration patrols that made him a national political figure, and a judge is deciding whether to hold him in contempt of court for defying a key order in a racial-profiling case. A separate criminal contempt hearing could be next.

Joel Robbins, an attorney who is a longtime critic of the sheriff, said it's time for Arpaio to get called into court to answer for his method of operation in dealing with his critics.

"This has been Arpaio's M.O. forever," Robbins said.

Critics say the sheriff's history of retribution stretches back to the late 1990s and continued until recently.

They point to two secret investigations involving U.S. District Judge Murray Snow, who had ruled that the sheriff's deputies racially profiled Latinos and brought the contempt case.

One investigation examined a claim that the judge's wife had allegedly told someone that Snow didn't want the sheriff to win re-election. The judge said the other investigation was intended to show an alleged conspiracy between Snow and federal authorities who are pressing the Justice Department's civil rights lawsuit against Arpaio.

"I'm not going to get into semantics about investigations," Arpaio said of the two investigations during an April 28 news conference. "We did the right thing — and that's the way it was done. I'm not going to talk about it."

Since then, the sheriff has declined requests to discuss the investigations. John Masterson, an attorney representing Arpaio in the case, didn't respond to requests for comment on the retaliation allegations.

Phoenix attorney Jack Wilenchik says he wasn't surprised when he saw headlines emerge from the contempt hearing about the investigation involving the judge's wife. He said he was having lunch with the sheriff months earlier on Sept. 24 at an Italian restaurant in Phoenix when he said Arpaio bragged about looking into the judge's wife.

"He was essentially bragging and claiming he was investigating her for something she said," Wilenchik said.

In addition to the retaliation claims, the upcoming civil rights trial will focus on allegations that Arpaio's office punished jail inmates with limited English skills for speaking Spanish and discriminated against Latinos in business raids. The investigations involving Snow aren't expected to be aired during the upcoming trial.

The sheriff has denied the Justice Department's allegations and called the case against him a politically motivated attack.

The Justice Department's retaliation allegations center heavily on disputes among Arpaio and county officials during a four-year period ending in 2010. Arpaio had argued he was trying to root out corruption in county government.

Superior Court Judge Gary Donahoe was arrested in his chambers in December 2009 on a bribery charge after he disqualified a prosecutor who was an Arpaio ally from an investigation into the construction of a court building.

An attorney-disciplinary panel of the Arizona courts focusing on the prosecutor concluded the sheriff's office hadn't done any investigation into the bribery allegation before filing the case and that there was no evidence that the judge accepted a bribe. In his 2011 testimony before the panel, Arpaio said he had little to do with his office's failed corruption investigations.

Other intimidation and retaliation allegations made against Arpaio's office over the years aren't expected to be covered at the trial.

Mike Manning, an attorney who represented the family of a man who died in 1996 while in one of Arpaio's jails, said a source within the sheriff's office told him the agency had prepared dossiers on him and the case's judge. Manning said the sheriff's office became interested in resolving the case after he asked for the dossiers. In the end, the county settled for $8.25 million.

In another case, a restaurant owner was investigated by Arpaio's office in a case that defense lawyer Paul Charlton, the former U.S. attorney in Arizona, has said was a bid to discourage him from cooperating with the Justice Department. Arpaio's office has denied Charlton's claim.

Former Mesa Mayor Scott Smith said he believes Arpaio's office launched a nighttime immigration raid on Mesa City Hall and Public Library in October 2008 as retaliation against the city's police chief. The chief was upset that the city wasn't being given advance notice when the sheriff was conducting immigration crackdowns in Mesa.

Smith said he met with the sheriff after the raid to try to resolve the dispute. "He made it clear that I make the chief of police know I can go into Mesa whenever I want," Smith said.