The U.S. Court of Appeals upheld yesterday part of a controversial new federal preventive detention law that allows judges to jail defendants charged with a second felony while out on bail when they are found to be a potential danger to the community.

The three-judge panel ruled, however, that prosecutors have the burden of proving that the defendant poses such a danger. The U.S. attorney's office here had argued that it was up to the defendant to prove that he would not be a danger.

The decision, by a 2-to-1 vote, came in the case of Walter McKethan, a District man who had been charged with a federal narcotics violation while out on bail on a previous narcotics charge, according to lawyers in the case. Prosecutors sought and won revocation of his bond under a controversial provision of the Comprehensive Crime Control Act of 1984.

McKethan appealed, and lawyers from the D.C. Public Defender Service and the American Civil Liberties Union entered the case as friends of the court. The ACLU has expressed concern about the new law, particularly the provisions allowing judges to deny bail on the basis of a defendant's potential danger to the community. Previously, judges could deny bail only if there was a substantial risk that the defendant would not appear for trial.

The panel sent the case back to the lower court for reconsideration based on its findings.

Yesterday, ACLU national staff counsel Chip Loewenson called the appeals decision "a standoff," adding, "We don't view this as the final word on the constitutionality of preventive detention."

James Knapp, deputy assistant attorney general of Justice's criminal division, said his "initial reaction" was that the ruling would have "no effect. It all depends on how the individual judges and magistrates choose to apply it."

Lawyers on both sides of the case said it appears to be the first ruling in the nation on this section of the hotly debated law -- a section that deals with defendants arrested for a second federal felony while free on bail on a previous charge.

However, various courts have ruled on the even more controversial part of the provision that allows bail to be denied to defendants charged with a first federal offense based on a finding of dangerousness. Those provisions have been upheld, according to Knapp.