Updated

Maricopa County Sheriff Joe Arpaio will appeal a federal judge's ruling that his agency systematically singled out Latinos in its trademark immigration patrols, marking the first finding by a court that the agency racially profiles people.

Tim Casey, the lead attorney representing America's self-proclaimed toughest sheriff in the case, said an appeal of the finding that the agency racially profiles people was planned in the next 30 days.

The decision by U.S. District Judge Murray Snow in Phoenix backs up years of allegations from Arpaio's critics who say his officers violate the constitutional rights of Latinos in relying on race in their immigration enforcement.

Snow, whose ruling came more than eight months after a seven-day, non-jury trial, also ruled Arpaio's deputies unreasonably prolonged the detentions of people who were pulled over.

The ruling marks a thorough repudiation of the immigration patrols that made Arpaio a national political figure, and it represents a victory for those who pushed the lawsuit.

"For too long the sheriff has been victimizing the people he's meant to serve with his discriminatory policy," said Cecillia D. Wang, director of the ACLU Immigrants' Right Project. "Today we're seeing justice for everyone in the county."

Monetary damages weren't sought in the lawsuit but rather a declaration that Arpaio's office engages in racial profiling and an order that requires it to make policy changes.

Stanley Young, the lead lawyer who argued the case against Arpaio, said Snow set a hearing for June 14 where he will hear from the two sides on how to make sure the orders in the ruling are carried out.

The sheriff, who has repeatedly denied the allegations, won't face jail time as a result of Friday's ruling.

Casey said that MCSO's position "is that it has never used race and will never use race in its law-enforcement decisions." He added the sheriff's office relied on "bad training" from the U.S. Immigration and Customs Enforcement.

"The decision here really affects some poor training from ICE and unfortunately we relied on ICE, acted on ICE, and now it turns out ICE was incorrect," Casey told MyFoxPhoenix.com.

In the meantime, Casey said the agency "will meet with the court and comply with the letter and spirit of the order."

A small group of Latinos alleged in their lawsuit that Arpaio's deputies pulled over some vehicles only to make immigration status checks. The group asked Snow to issue injunctions barring the sheriff's office from discriminatory policing and the judge ruled that more remedies could be ordered in the future.

The group also accused the sheriff of ordering some immigration patrols not based on reports of crime but rather on letters and emails from Arizonans who complained about people with dark skin congregating in an area or speaking Spanish. The group's attorneys noted Arpaio sent thank-you notes to some who wrote the complaints.

The sheriff said his deputies only stop people when they think a crime has been committed and that he wasn't the person who picked the location of the patrols. His lawyers said there was nothing wrong with the thank-you notes.

Young, the group's lawyer, said he was still reading the decision Friday but noted it contained "very detailed findings of discriminatory intent and effect."

A call to ICE officials in Phoenix for comment wasn't immediately returned Friday evening.

Arpaio, who turns 81 next month, was elected in November to his sixth consecutive term as sheriff in Arizona's most populous county.

Known for jailing inmates in tents and making prisoners wear pink underwear, Arpaio started doing immigration enforcement in 2006 amid Arizona voter frustration with the state's role as the nation's busiest illegal entryway.

Snow wrote that "in the absence of further facts that would give rise to reasonable suspicion or probable cause that a violation of either federal criminal law or applicable state law is occurring," Arpaio's office now is enjoined from enforcing its policy "on checking the immigration status of people detained without state charges, using Hispanic ancestry or race as any factor in making law enforcement decisions pertaining to whether a person is authorized to be in the country, and unconstitutionally lengthening stops."

Snow added "the evidence introduced at trial establishes that, in the past, the MCSO has aggressively protected its right to engage in immigration and immigration-related enforcement operations even when it had no accurate legal basis for doing so."

The trial that ended Aug. 2 focused on Latinos who were stopped during both routine traffic patrols and special immigration patrols known as "sweeps."

During the sweeps, deputies flood an area of a city -- in some cases, heavily Latino areas -- over several days to seek out traffic violators and arrest other offenders. Immigrants who were in the country illegally accounted for 57 percent of the 1,500 people arrested in the 20 sweeps conducted by his office since January 2008, according to figures provided by Arpaio's office.

At trial, plaintiffs' lawyers drew testimony from witnesses who broke down in tears as they described encounters with authorities, saying they were pulled over because they were Hispanic and officers wanted to check their immigration status, not because they had committed an infraction. The sheriff's attorneys disputed such characterizations, typically working to show that officers had probable cause to stop the drivers based on a traffic violation.

Plaintiffs' lawyers also presented statistics to show Latinos are more likely to be stopped on days of immigration patrols and showed emails containing offensive jokes about people of Mexican heritage that were circulated among sheriff's department employees, including a supervisor in Arpaio's immigrant smuggling squad.

Defense lawyers disputed the statistical findings and said officers who circulated offensive jokes were disciplined. They also denied the complaint letters prompted patrols with a discriminatory motive.

The ruling used Arpaio's own words in interviews, news conferences and press releases against him as he trumpeted his efforts in cracking down on immigrants. When it came to making traffic stops, Arpaio said in 2007 that deputies are not bound by state laws in finding a reason to stop immigrants.

"Ours is an operation, whether it's the state law or the federal, to go after illegals, not the crime first, that they happen to be illegals," the ruling quoted Arpaio as saying. "My program, my philosophy is a pure program. You go after illegals. I'm not afraid to say that. And you go after them and you lock them up."

Some immigrant traffic stops were made "purely on the observation of the undercover officers that the vehicles had picked up Hispanic day laborers from sites where Latino day laborers were known to gather," the ruling said.

The judge also said the sheriff's office declared on many occasions that racial profiling is strictly prohibited and not tolerated, while witnesses said it was appropriate to consider race as a factor in rounding up immigrants.

"This is a blow to" the sheriff's office, said David A. Harris, a law professor at the University of Pittsburgh who studied racial profiling and wrote a book on the subject.

Arpaio's lawyers will have "an uphill climb" in the appeals process because of all "the gross statistical evidence," he said.

Click here for more from MyFoxPhoenix.com.

The Associated Press contributed to this report.