Facebook user data in bulk was sought last year by the New York County District Attorney’s office and a court directed it to produce virtually all records and communications for 381 accounts, the company disclosed Thursday.

The social networking giant is now asking the court for the return or destruction of the data as well as a ruling on whether the bulk warrants violated the Fourth Amendment to the U.S. Constitution and other laws. The Fourth Amendment prohibits unreasonable searches and seizures of property.

The company said that since last July it has been fighting a set of sweeping search warrants issued by the Supreme Court for New York County that demanded that it turn over to law enforcement nearly all data from the accounts of the 381 people, including photos, private messages and other information.

Facebook was also prohibited from informing the targeted persons, who included “high schoolers to grandparents, from all over New York and across the United States,” and electricians, school teachers, and members of the country’s armed services.

Of the 381 people whose accounts were covered under the warrants, 62 were later charged in a disability fraud case, Facebook’s deputy general counsel Chris Sonderby wrote in a post on Thursday.

The request from New York is described by the company as the largest it has received, “by a magnitude of more than ten.”

The social networking company last Friday asked the appellate division of the New York State Supreme Court to force the government to return the data it has seized and retained.

The government’s own investigation confirms “that most of the Facebook user data seized by the Government is irrelevant to the charges alleged, and the search warrants are overbroad and constitutionally defective,” the company wrote in the court filing.

After Facebook filed the appeal, the government unsealed the warrants and all court filings, which has enabled Facebook to notify the people whose accounts were affected about the warrants and its ongoing legal efforts, Sonderby wrote.

Facebook’s appeal focuses on whether it has the standing to challenge the warrants, whether the warrants, which authorized collection of large amounts of personal information and communications without an “apparent connection to the crimes under investigation, or procedures requiring the return of the seized information” are in violation of the Fourth Amendment, and whether the gag provisions of the warrants violate the Stored Communications Act and the First Amendment.

The trial court had ruled in the negative on these issues, Facebook wrote in the filing. In an order dated Sept. 17 last year, Judge Melissa C. Jackson denied Facebook’s motion to quash the 381 search warrants and required Facebook to locate and produce user information.

Facebook claims it has standing to contest the warrants for a number of reasons, including third-party standing that “will avoid diluting the constitutional rights of hundreds of individuals whose personal information has now been seized by the Government without their knowledge.”

“The vast scope of the Government’s search and seizure here would be unthinkable in the physical world,” Facebook wrote in its filing, comparing the demand for all communications and information in 24 broad categories from the 381 targeted accounts as the digital equivalent of seizing everything in someone’s home.

“Sometimes ‘come back with a warrant’ is not enough,” wrote digital rights group Electronic Frontier Foundation in a blog post. “The warrant must also conform to constitutional limitations, narrowly seeking evidence of a crime with particularity, based on probable cause.”