Orin S. Kerr, a law professor at George Washington University who is an expert on digital searches and seizures, said Facebook was trying to do something unusual in establishing a right for service providers to challenge a warrant. “The real question is, ‘Can they challenge warrants for their customers?’ And I think the answer is probably not, under current law,” Mr. Kerr said.

Chris Sonderby, deputy general counsel for Facebook, said that if Facebook could not challenge the warrants and the users remained in the dark, no one would ever get the chance to object to the possible invasion of privacy. “It appeared to us from the outset that there would be a large number of people who were never charged in this case,” he said. “The district attorney’s response was that those people would have their day in court. There are more than 300 people that will never have that chance.”

Mr. Sonderby said that the district attorney’s demand for data was far larger than anything it had ever received from any other prosecutor. And Mr. Vance’s office was unwilling to discuss narrowing the scope of its requests to be more directly relevant to its investigation.

The relationship was so chilly, said Mr. Sonderby, that when Facebook pressed its challenge to the warrants, one of the prosecutors called and threatened to press criminal contempt of court charges against the company and throw its officials in jail. “I’ve never seen anything like it,” he said.

The district attorney’s office said that about 600 possible suspects have been identified, and the investigation was continuing. Prosecutors said they had provided Supreme Court Justice Melissa C. Jackson with a 93-page affidavit with evidence to support each of the individual warrants, including information from wiretaps and documents filed with the Social Security Administration. They also maintain almost everything in the Facebook pages was relevant, since the people targeted in the investigation were faking mental illnesses to obtain benefits and had claimed to be too sick to leave the house, travel or work.

Justice Jackson, in denying Facebook’s effort to quash the warrants, said that the government must be granted some latitude. “In the course of a long-term criminal investigation, the relevance or irrelevance of items seized within the scope of a search warrant may be unclear and require further investigatory steps,” she wrote.