A Manhattan judge has ordered Airbnb to comply with city subpoenas seeking user data in an investigation of allegedly illegal property rentals, but said production would be tailored to protect the privacy of hosts.

Manhattan Supreme Court Justice James E. d'Auguste late on Thursday said the city was well within its rights to review company information pertaining to rental transactions in Manhattan, Brooklyn and Queens dating back to 2011.

However, he modified the city's subpoena with regard to at least 29 other Airbnb hosts, who had listed apartments on the home-sharing website but had never actually rented them out. For those users, d'Auguste said, the court would privately review records to see if they were relevant to the probe, which is headed by the Mayor's Office of Special Enforcement.

“By amending the subpoenas in this fashion, this court is not necessarily preventing OSE from obtaining information relating to individuals who have posted listings where those listings have not resulted in a reservation, but rather limiting Airbnb's obligation to produce this information at this time,” he wrote in a 25-page decision and order.

“If the court finds the information relevant to the investigation, then OSE can potentially have such access on such information in a second phase of production,” he said.

The ruling was the latest development in the ongoing legal fight between city officials and the San Francisco-based technology company.

The New York Law Journal previously reported that since 2010, it has been illegal under New York state law to rent out dwellings in multifamily buildings in New York City for less than 30 days, which effectively outlaws Airbnb in much of the city. Last year, the city, through the OSE, issued Airbnb four subpoenas, including two requesting documents related to buildings that are the subject of pending lawsuits.

“The decision makes clear to all online platforms that OSE is entitled to evidence related to illegal short term rentals,” Christian J. Klossner, the OSE's executive director, said in a statement Friday.

The city said in court filings that it was operating under a “clear public mandate” to stop attempts to convert permanent residencies into “ersatz” or “faux” hotels, which it argued reduce the city's housing stock and jeopardize the safety of New Yorkers and Airbnb guests.

Airbnb, however, challenged the subpoenas on privacy grounds, saying that they threatened to compromise the private information of thousands of its users. With regard to one of the subpoenas, Airbnb said, at least 29 of 76 host accounts that had posted listings never resulted in an actual reservation.

On Thursday, d'Auguste said those records would be subject to in camera review, and the city would be able to make submissions arguing for the need and relevancy of the materials. A confidentiality order, he said, would also be entered to address any privacy concerns related to user information.

A spokeswoman for Airbnb said Friday that the company was “pleased that the court recognized the need to protect our users' privacy rights in this matter.”

“We look forward to continuing to work with the city and appreciate that we now have a path forward to comply with the remainder of these subpoenas in alignment with applicable legal standards,” she said.

Airbnb is represented in the matter by Nicholas Jackson and Jacob Sommer of ZwillGen.