The opinion by US District Judge G. Murray Snow came on the same day he issued legal sanctions against Arpaio over destroyed documents.

The sheriff already has faced rebukes from federal agencies over his controversial efforts to crack down on illegal immigration.

Both rulings by Snow stemmed from a 2007 civil lawsuit against Arpaio and his agency, which accuses his officers of racial profiling of Latinos in traffic stops the judge found were conducted as immigration sweeps.

The judge also said officers with the Maricopa County Sheriff’s Department, which covers Phoenix and surrounding areas, circulated e-mails that “compared Mexicans to dogs” and portrayed them “as drunks.”

“Local law enforcement agencies ... may not enforce civil federal immigration law,” Snow said in his written opinion.

He added that the sheriff’s agency could not detain “any person based only on knowledge or reasonable belief, without more, that the person is unlawfully present within the United States.”

In his ruling, Snow also granted a request by plaintiffs to certify the lawsuit as a class action.

Last week, the US Justice Department accused Arpaio and his deputies of engaging in a “pervasive culture of discriminatory bias” and violating civil rights laws by singling out Latinos for unlawful detention and arrests. The same day, the US Department of Homeland Security barred Arpaio’s deputies from screening jail inmates for their immigration status.

Arpaio’s actions on illegal immigration in Maricopa County have earned him accolades in conservative political circles.