A federal appeals court Friday upheld a controversial federal drug-testing regulation that requires same-gender observers to watch some transportation workers while they take urine tests to make sure they aren't cheating.

The regulation, implemented by the U.S. Department of Transportation, applies to aviation, rail and other transportation workers who have previously failed a drug test or refused to take one.

Several transportation industry unions and the BNSF Railway Co. (BNI) challenged the regulation, saying it was an arbitrary rule that violated workers' constitutional right to be free from unreasonable searches.

In a unanimous ruling, the U.S. Court of Appeals for the District of Columbia Circuit said the need for transportation safety trumped the privacy concerns raised by the drug-testing policy.

"Individuals ordinarily have extremely strong interests in freedom from searches as intrusive as direct observation urine testing," Judge David Tatel wrote. "In this case, however, those interests are diminished because the airline, railroad and other transportation employees subject to direct observation perform safety-sensitive duties in an industry that is regulated pervasively to ensure safety."

The appeals court said the Transportation Department carefully considered voluminous evidence on the increasing availability of products to help workers cheat on drug tests. The court also said it was reasonable for the department to conclude that workers who had failed a drug test previously would have a heightened incentive to cheat on a drug test in the future.

Neither the Transportation Department nor BNSF immediately returned calls for comment. Unions opposing the testing policy included the International Association Of Machinists and Aerospace Workers and the Air Line Pilots Association.

-By Brent Kendall, Dow Jones Newswires; 202-862-9222; brent.kendall@dowjones.com