The California Supreme Court sided with Gilead Sciences in a closely watched case brought by thousands of patients who argued the company was negligent for slow-walking development of an HIV medicine that was safer than another drug it was already selling.

In a 6-to-1 decision, the court overturned a state appeals court ruling two years ago that Gilead could be held liable, raising alarm in the pharmaceutical industry that drug development decisions could be influenced by the fear of legal liability.

The case began after more than 24,000 people claimed in federal and state court lawsuits that they unnecessarily suffered kidney injury and bone loss from the older drug. They maintained that Gilead cynically managed its product pipeline at the expense of people who should have been treated with a safer medicine.