A federal program to test government employees suspected of off-duty drug use has been imperiled by a court decision that struck down such checks at the Agriculture Department.

The ruling Friday by a panel of the U.S. Court of Appeals for the D.C. Circuit is the first by a federal appellate court on whether the government may test employees suspected of off-duty drug use that does not affect job performance.

The panel upheld random testing of USDA drivers because drug use might endanger public safety.

At the same time, the court ruled in a case involving White House employees that government officials with access to "secret" information may be subject to random drug testing, as are officials with "top secret" clearances.

In the USDA case, the three-judge panel struck down regulations under which employees of the Food and Nutrition Service could be tested if they were suspected of off-duty drug use.

"Because USDA regulations authorize urinalysis testing of ordinary employees who are not suspected of on-duty drug use or impairment, and because those regulations mandate needlessly intrusive testing procedures, we find them unconstitutional," the court said.

While the ruling involved one component of USDA, it has government-wide implications because most federal agencies have adopted similar drug testing programs, said Elaine Kaplan, an attorney for the National Treasury Employees Union, which brought the case.

The ruling means that "in order to drug test the vast majority of federal employees, the government has to have individualized suspicion of on-duty drug use or on-duty impairment caused by drug use," Kaplan said. "This is a significant limit on what they were trying to do."

The panel, in an opinion by Circuit Judge Abner J. Mikva, said that "the government has not produced evidence that might establish a relationship between off-the-job drug use and government efficiency or on general integrity and deterrence rationales."

"The government may investigate and punish wrongdoing within the walls of its offices," Mikva wrote.

"What the government may not do in the case of ordinary employees is justify drug testing procedures that intrude upon constitutionally protected privacy interests with speculation about possible future job impairment or rules violations."

Mikva was joined by Circuit Judges Laurence H. Silberman and Harry T. Edwards.

The ruling, which partially reversed a lower court opinion, also struck down a portion of the regulations that allowed USDA officials to monitor employees while they provide urine samples without any suspicion that a worker might tamper with the specimen before it was tested.

The court called this an invasion of privacy.

In the other case, the same panel, over Edwards's dissent, upheld a policy of randomly testing employees of the Executive Office of the President holding "secret" security clearances. Courts previously upheld random drug tests of employees with "top secret" clearances.

American Civil Liberties Union attorney Arthur B. Spitzer said the case means that any government employee with a "secret" clearance eventually will be subjected to random drug testing.

"It's another diminution of important constitutional rights because of the anti-drug hysteria," Spitzer said.

Edwards said that "this case is not the first Fourth Amendment casualty claimed by the war on drugs. Nor, in all likelihood, will it be the last.

"I fear today's decision finds us unwilling to do what we must to preserve fundamental Fourth Amendment freedoms."

The Fourth Amendment protects individuals from unreasonable search and seizure.