Facebook is fighting a US court order in which it was forced to hand over data belonging to almost 400 people involved in a benefit fraud trial.
Photographs, private messages and other information were supplied to a New York court last year, but the process was only made public by a judge this week.
The ruling defined Facebook as a “digital landlord”.
A judge said this definition meant the company must comply with search warrants.
The original case investigated fraudulent claimants of US federal disability benefits, whose Facebook accounts apparently showed that they were in fact healthy.
The web giant was ordered to hand over information from the 381 accounts, which the court said contained “evidence of criminality”.
After an appeal was denied, Facebook complied with the request but protested that it violated the Fourth Amendment of the US constitution, which protects against “unreasonable searches and seizures”.
Facebook also voiced concerns about the lack of date restrictions on the warrant, which it argued allowed the US government to keep the data indefinitely.
The proceedings have been kept private by the court, but after a fresh appeal by Facebook a New York judge has now made the court filing public.
Facebook said the government had obtained “gag orders”, preventing it from telling the account holders that it had been forced to hand over their data.
“This unprecedented request is by far the largest we’ve ever received – by a magnitude of more than ten – and we have argued that it was unconstitutional from the start,” wrote Chris Sonderby, a legal adviser to Facebook.
“Of the 381 people whose accounts were the subject of these warrants, 62 were later charged in a disability fraud case.
“This means that no charges will be brought against more than 300 people whose data was sought by the government without prior notice to the people affected.”
But a spokesperson for the Manhattan district attorney defended the court’s actions.
“This was a massive scheme involving as many as 1,000 people who defrauded the federal government,” said Joan Vollero.
“The defendants in this case repeatedly lied to the government about their mental, physical, and social capabilities. Their Facebook accounts told a different story.”
In a summation of the legal justification for the court’s decision, the judge wrote: “Facebook could best be described as a digital landlord, a virtual custodian or storage facility for millions of tenant users and their information.
“Hence, the search warrants authorise the search and seizure of digital information contained within the Facebook server.”