Justice Sonia Sotomayor warned in a dissent to a previous ruling on the case that the decision exposes “thousands to the risk of torture or death.”