“Any illegal drug use in a family is harmful and even abusive to a child,” he said in a statement. “We should have a zero-tolerance policy for illegal drug use in families — especially those families who struggle to make ends meet and need welfare assistance to provide for their children.”

Florida passed the measure in 2011, and the case was being closely watched by several other states, including Georgia, which passed similar legislation in 2013 but found it dogged by legal challenges. State data in Florida also showed that the measure produced few results. Only 108 out of 4,086 people tested — 2.6 percent — were found to have been using narcotics. State records showed that the requirement cost more money to carry out than it saved.

But as the country emerged from the recession, numerous states, powered by the strength of Republicans in many legislatures, sought to make welfare or unemployment checks contingent on drug testing. That is despite a 2003 federal court ruling in Michigan that struck down drug testing for welfare recipients because it amounted to an illegal search.

Image Luis W. Lebron, a Navy Veteran, argued that it was unfair to require drug testing when no suspicion of drug abuse existed. Credit... A.C.L.U.

“In Michigan a number of years ago there was a court decision that had a chilling effect on these kinds of proposals,” said Grant Smith, policy manager of the Drug Policy Alliance, an organization that advocates more liberal drug-use laws. “This new ruling should give pause. We have seen a number of proposals continue to be put forward across the country, but the writing is on the wall that requiring people to submit to drug testing for no reason other than being poor and in need of assistance is not going to pass constitutional muster. It’s not fair, it’s not cost effective, and it’s unreasonable.”