Protecting the confidentiality of patients isn't an absolute duty: When physicians believe that a patient could harm another, they should report it to proper authorities or warn the intended target. But they shouldn't testify in the patient's trial. At least that's the opinion of the Ninth US Circuit Court of Appeals in California.
According to American Medical News (9/15/03), the federal appeals court reasoned that "a physician testifying against a patient in a courtroom would have a far more damaging impact on the physician-patient relationship than a physician going to authorities to report information." Specifically, the court noted that a patient who is convicted based in part on the testimony of his or her physician would certainly be less trustful of medical professionals and, in turn, would be more reluctant to seek further treatment for her condition.