NEW YORK (Reuters) - A federal judge on Thursday blocked a New York City law requiring Airbnb to hand over data each month about people who use its apartment listing service from taking effect while the company challenges the law in court.

The logos of Airbnb are displayed at an Airbnb event in Tokyo, Japan, June 14, 2018. REUTERS/Issei Kato

The preliminary ruling, handed down by U.S. District Judge Paul Engelmayer in Manhattan, could be a boon to the San Francisco-based company as it prepares for a widely anticipated initial public offering later this year.

The judge will not enter a final ruling until later in the case, after both sides have exchanged evidence.

“The decision today is a huge win for Airbnb and its users, including the thousands of New Yorkers at risk of illegal surveillance who use Airbnb to help make ends meet,” Airbnb said in a statement.

“This is a law to stop landlords from creating de facto hotels, which is unfair and illegal,” New York City Mayor Bill de Blasio said when asked about the decision at a press conference. “We believe we’ll ultimately prevail.”

Airbnb allows users to lease or sublease their homes to guests through an online service. The company’s critics in New York and other major cities say the service contributes to high housing costs and overcrowding.

In 2010, in an effort to address those concerns, the state of New York passed a law banning apartment rentals for periods of less than 30 days unless a permanent resident remains in the apartment. New York City also bans short-term apartment rentals in many cases.

The new city law, which was passed last July and was scheduled to take effect next month, aimed to help the city identify Airbnb listings that ran afoul of the short-term rental laws.

It would require Airbnb and providers of similar services to turn over information about its users, including names, addresses and details of how they used the service, each month.

Airbnb and another home-sharing company, HomeAway.com Inc, both sued the city last year seeking to block the law. Thursday’s order applies to both companies’ cases.

Airbnb and HomeAway argued that the law ran afoul of the U.S. Constitution’s protection against unreasonable search and seizure of private property by the government.

Engelmayer said in Thursday’s ruling that the companies were likely to prevail in their argument. He said the scope of the information required by the law was “breathtaking,” encompassing “virtually all monthly information the service receives from each user.”