The 142-page decision by U.S. District Judge Murray Snow in Phoenix backs up allegations that Maricopa County Sheriff Joe Arpaio's critics have made for years that his officers rely on race in their immigration enforcement.
Snow also ruled Arpaio's deputies unreasonably prolonged the detentions of people who were pulled over.
A small group of Latinos alleged in a lawsuit that Arpaio's deputies pulled over some vehicles only to make immigration status checks.
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 pointed out that Arpaio sent thank-you notes to some people who wrote the complaints.
The sheriff has repeatedly denied the allegations, saying 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 also said there was nothing wrong with the thank-you notes.
Cecillia D. Wang, director of the ACLU Immigrants' Right Project, called the ruling a "great day for all the people of Maricopa County."
Arpaio's lead attorney Tim Casey was reading Snow's decision Friday afternoon before commenting on it.
The sheriff, known for jailing inmates in tents and making prisoners wear pink underwear, started doing immigration enforcement six years as Arizona voters grew frustrated with the state's role as the nation's busiest illegal entryway.
The ruling represents a victory for those who pushed the lawsuit. They weren't seeking money damages but a rather declaration that Arpaio's office racially profiles and an order that requires it to make policy changes. The sheriff won't face jail time or fines as a result of the ruling.
Copyright 2013 The Associated Press.