A New York state appeals court ruled on Tuesday that Facebook had no legal standing to challenge search warrants on behalf of its customers, a decision that dealt a blow to civil libertarians and social media companies seeking to expand Internet privacy.

Upholding a lower court decision, the five-judge panel in Manhattan said that under state and federal law only a defendant can challenge a search warrant, and it must be done during a hearing before trial. At that point, defendants can move to have evidence thrown out as the fruit of an illegal search.

But Facebook, as the online entity storing material, does not have the power to ask a judge to throw out search warrants before they have been executed, said Judge Dianne T. Renwick, who wrote the unanimous opinion. “There is no constitutional or statutory right to challenge an allegedly defective warrant before it is executed,” she wrote.