Georgia will not drug-test food stamp recipients under a controversial new law that federal and state officials concluded was illegal, the governor's office said Friday.

The Republican-controlled legislature this spring passed a law that required testing if authorities had a “reasonable suspicion” of drug use. Adults failing the test would temporarily lose food stamp benefits, although children could still receive them.

The drug testing law, set to take effect July 1, drew an outcry from civil liberties advocates, who said it violated the constitutional protection against unreasonable searches. They also said that the law could scare away many who rely on food stamps to feed themselves and their families.

Recently, the U.S. Department of Agriculture and Georgia’s attorney general determined the testing plan violated federal law.

“The law is the law,” said Rep. Greg Morris, the measure’s Republican sponsor, backing away from earlier calls to fight in court for drug testing.

Georgia Attorney General Sam Olens said the state risked losing funding for food stamps if it enforced drug testing.

“The very essence of the rule of law is that we follow the law even if we disagree with it,” Olens, a Republican, wrote in a letter to the governor.

Republican Gov. Nathan Deal, who signed the law, will abide by the attorney general’s opinion, a spokesman said Friday.

A federal judge late last year struck down a Florida bill requiring drug screening for welfare recipients, ruling it violated the constitutional prohibition of unreasonable searches.

But Mississippi in March passed a similar law that has so far been unchallenged at the federal level.

The Georgia law would have faced a similar challenge, said Debbie Seagraves, executive director of the American Civil Liberties Union of Georgia.

Al Jazeera and wire services