The ruling at the Supreme Court is the latest in a long-running legal dispute.