Brooklyn listings on Airbnb’s website. (BARBARA LEONARD / COURTHOUSE NEWS SERVICE)

MANHATTAN (CN) – Blocking an attempt to glean massive amounts of user data from Airbnb, a federal judge slammed New York City on Thursday for pioneering a brave new world of “breathtaking” searches and seizures.

“The ordinance realistically could arise only in a world of cyber-stored data, in which e-commerce companies maintain vast electronic databases as to their users, from which they can, if compelled, regularly reproduce voluminous stored data for regulators,” U.S. District Judge Paul Engelmayer said in a 52-page ruling.

Engelmayer also called it hard to imagine an analogue of the law in the world of brick and mortar.

“An attempt by a municipality in an era before electronic data storage to compel an entire industry monthly to copy and produce its records as to all local customers would have been unthinkable under the Fourth Amendment,” the opinion states.

In its longstanding battle with the online home-sharing industry, New York City has depicted Airbnb as a public health and safety threat for encouraging rentals that do not comply with fire and building codes and drive up rents.

This past July the City Council passed an ordinance that required Airbnb to disclose the names and addresses of all its hosts across the five boroughs, as well as data on Airbnb’s users, like the rental listing URL, the number of days the unit is rented and how much the platform collects in fees.

The San Francisco-based Airbnb and its Austin-based competitor HomeAway fired back a month later with in a federal complaint in Manhattan, accusing the city of kowtowing to hotel industry lobbying.

Airbnb celebrated its speedy victory Thursday as a win for their users and “the thousands of New Yorkers at risk of illegal surveillance who use Airbnb to help make ends meet.”

“The court today recognized the fundamental importance of New Yorkers’ constitutional rights to privacy and the sanctity of their own homes,” a spokeswoman for the company said in a statement.

Judge Engelmayer’s scathing opinion engages in thought experiments about what would be permissible if the city’s ordinance were found constitutional.

“By the city’s logic, a City Council presumably could also compel (1) all online auction services monthly to produce all records of sales by New York City residents, on the premise that such records could assist in finding sellers who evaded capital gain taxes on sales of collectibles; (2) all medical providers monthly to produce all patient records for care rendered in New York City, on the premise that such records could assist in finding instances in which users engaged in up-coding and other health-care fraud; and (3) all credit card companies monthly to produce all records of expenditures in New York restaurants, on the premise that such records could assist in identifying instances in which commercial income was not reported to tax authorities,” the opinion states.

Without commenting on Airbnb’s claims that City Council acted at the behest of the hotel lobby, Judge Engelmayer noted that both industries share privacy interests.

“Like a hotel, a home-sharing platform has at least two very good reasons to keep host and guest information private, whether as to these users’ identities, contact information, usage patterns, and payment practices,” he wrote. “One is competitive: Keeping such data confidential keeps such information from rivals (whether competing platforms or hotels) who might exploit it. The other involves customer relations: Keeping such data private assuredly promotes better relations with, and retention of, a platform’s users.”

If the ordinance were in effect in 2016, it would have forced Airbnb to turn over a “wholesale replica” of its database on more than 700,000 bookings, except for photos and videos of the dwellings, the opinion states.

In granting a preliminary injunction, Engelmayer said that New York City had less intrusive tools at its disposal to regulate the home-sharing economy.

“To be sure, the public has an interest in preventing the social ills that may result from the proliferation of short-term rentals in ways that violate the Multiple Dwelling Laws,” he wrote. “But, as noted, the issuance of a preliminary injunction ought not to significantly impair the city’s ability to safeguard those interests during the pendency of this litigation, as the city retains its existing investigative tools such as subpoenas and is at liberty to enhance the resources dedicated to this area if it determines that such serves the public interest.”

Robbie Kaplan, an attorney for Airbnb at the firm Kaplan Hecker & Fink, said the ruling vindicates the company’s position.

“No government can force a company to simply turn over its entire hard drive every month without any form of precompliance review,” Kaplan said in a statement. “Judge Engelmeyer’s cogent and comprehensive opinion takes old world concepts which inspired the founders to enact the Fourth Amendment in the first place and applies them to today’s modern, high-tech world.”

HomeAway said in a statement it hoped the ruling would send a “strong signal to other cities looking to emulate New York City’s misguided law.”

Mayor Bill de Blasio is expected to address the ruling in an ongoing press conference.