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

The Republican-controlled legislature this spring passed a law requiring testing if authorities had a "reasonable suspicion" of drug use. People 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 outcry from civil liberties advocates, who said it violated the constitutional protection against unreasonable searches.

Recently, both the U.S. Department of Agriculture and Georgia's attorney general determined the drug 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 for drug testing in court.

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 Governor Nathan Deal, who signed the law, will abide by the attorney general's opinion, a spokesman said on Friday.

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

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