FOR THE crime of appearing Hispanic, Roxana Santos, a native of El Salvador, attracted the attention of Frederick County sheriff’s deputies in 2008. At the time she was noticed and racially profiled by the deputies, Ms. Santos was doing nothing more than sitting on a curb and eating a sandwich outside the food co-op in Frederick where she worked as a dishwasher.

In Frederick, where Sheriff Charles Jenkins has publicly pledged to make life unfriendly for undocumented immigrants, it’s open season for law enforcement on anyone who looks the part — meaning anyone who looks Hispanic.

The deputies, Kevin Lynch and Jeffrey Openshaw, acted on no suspicion of criminal conduct. Indeed, Ms. Santos, who is undocumented, has no criminal history. Nonetheless, they approached her, asked for her identification and, after a considerable wait, told her to sit tight while a federal data base digested her name. No, she would not be on time for her shift.

On Wednesday, a federal appeals court slapped down Mr. Jenkins and the county sheriff’s department. The appeals court said that law enforcement officers may not go around accosting people merely on the suspicion that they may lack immigration documents, no matter what they look like or how limited their facility with English. As the court pointed out, an individual’s unauthorized presence in the United States is not a crime; it’s a civil violation of immigration law.

The ruling by the U.S. Court of Appeals for the 4th Circuit, in Richmond, is consistent with last year’s Supreme Court ruling on Arizona’s anti-immigrant statute. In that case, the Supreme Court allowed police to determine the immigration status of people they stop or arrest for other reasons. But Justice Anthony Kennedy, writing for the court’s majority, noted it is not a crime for an illegal immigrant to be present in the country. “Detaining individuals solely to verify their immigration status would raise constitutional concerns,” he wrote.

In the case of Ms. Santos, the appeals court pointed out that police who start asking questions based solely on the race or ethnicity of their interlocutor may also run afoul of the Fourth Amendment’s equal protection clause.

All this may come as news to Mr. Jenkins, whose tough-guy political persona is wrapped up in harassing illegal immigrants, whom he blames for all sorts of problems, including Maryland’s budgetary travails.

About 8 percent of Frederick County’s 240,000 people are Hispanic, and minorities generally have contributed heavily to the county’s rapid growth. That may be jarring to some county residents; it surely has presented political opportunities to officials such as Mr. Jenkins, who have gotten mileage from bashing illegal immigrants.

Nonetheless, it is the sheriff’s job to uphold the law. And in the absence of probable cause to suspect criminal activity, the Fourth Amendment prohibition of unreasonable searches and seizures forbids police from harassing people based solely on their presumed immigration status.

Ms. Santos, a mother of three, remains in the country while her court case continues, although she may still face deportation. In the meantime, the appeals court has determined that her constitutional rights were violated. Let’s hope Mr. Jenkins gets the message.