A federal appeals court, in a strong rebuff to local law enforcement agencies that aggressively pursue people they suspect of being illegal immigrants, ruled Wednesday that the Frederick County Sheriff’s Office did not have the right to arrest Roxana Santos, a Salvadoran dishwasher who was seized while eating a sandwich outside her workplace in the fall of 2008 and jailed for the next 45 days.

The ruling, from the U.S. Court of Appeals for the 4th Circuit, based in Richmond, appeared to clarify and strengthen a somewhat ambiguous Supreme Court decision last year in Arizona v. United States, in which the high court expressed reservations but did not explicitly state how far local police may go when they seek to identify, arrest and aid in deporting individuals who might be in the country illegally but are not involved in criminal activity.

The high-profile issue of whether police can enforce federal immigration law also was raised last year in Alabama and several other states where officers had been accused of harassing illegal immigrants at traffic stops and in other situations, either to force them to leave the area or to have them deported.

“We hold that, absent express direction or authorization by federal officials, state and local law enforcement officers may not detain or arrest an individual solely based on known or suspected civil violations of federal immigration law,” the court concluded after a long and detailed analysis of the encounter between Santos and the officers.

Officials from pro-immigrant groups in Maryland, who helped Santos pursue a legal complaint in the incident, described the ruling as a reinforcement of their longtime allegations that Frederick authorities, under the leadership of Sheriff Chuck Jenkins, had attempted to drive out illegal immigrants in ways that broke the law.

“Sheriff Jenkins really declared war on the most rapidly growing population in Frederick County,” said Kim Propeack, a spokeswoman for Casa of Maryland, an immigrant advocacy group. “This ruling definitely vindicates Roxana and the many hundreds of people there who have been pulled over on a pretext, even a broken taillight, in order to push them into deportation.”

Jenkins’s office said Wednesday evening that he would have no comment on the ruling. An outspoken opponent of illegal immigration, Jenkins has been a longtime lightning rod in the divisive issue. His department was the only law enforcement agency in Maryland to sign on to a program of formal cooperation with federal immigration authorities in which local officers detained and turned over suspected illegal immigrants.

Santos filed a lawsuit against Frederick County through pro-immigrant groups and sympathetic law firms, claiming that her constitutional rights had been violated when she was arrested. The lawsuit was dismissed by the U.S. District Court in Maryland last year, but the Wednesday ruling overturned that order.

In detailed and precise language, the court re-created the entire encounter between Santos and two deputy sheriffs. It found that they had illegally “seized” Santos when she tried to get up from her bench and walk away and that they did not have the right to arrest her merely because they had ascertained, after questioning her while she sat eating a sandwich in a public park, that she was facing a federal deportation order as an illegal immigrant.

Santos, a mother of three who speaks little English, was released from federal custody while the court case was continuing, but she still could face deportation. The court found, however, that even though she is an illegal immigrant, her constitutional rights to protection from “unreasonable search and seizure” were violated.

The defendants had argued that the officers had not harmed or threatened her and that they had arrested her only after learning there was a deportation order pending against her.