Airbnb, the online lodging service that investors now believe is worth US$30 billion, faces a reckoning.
In eight years of torrid growth, the company has often clashed with local public officials seeking to minimise the impact of short-term rentals on neighbourhoods and urban housing markets. Now, those simmering tensions are starting to boil.
New York Governor Andrew Cuomo on Friday signed legislation that Airbnb says could seriously damage its business in New York City, the company's largest US market; the company immediately filed a lawsuit in federal court seeking to overturn the law.
The German capital of Berlin recently passed a law banning most short-term rentals, and Barcelona and Amsterdam are imposing steep fines for listings that violate laws there.
Airbnb is also engaged in a pitched battle in its home of San Francisco, where the company has also sued to block a new requirement that it reject booking fees from property owners who have not registered with the city.
The New York and San Francisco legal fights are a crucial test of Airbnb's business model.
The company argues it cannot legally be held responsible for how landlords use its platform. If it is required to enforce local laws on short-term rentals, that could drastically reduce listings - and revenue - in some of its biggest markets.
Airbnb's legal argument in the San Francisco and New York cases rely on a 20-year-old statute designed to protect free speech online, known as Section 230 of the Communications Decency Act.
In the San Francisco lawsuit, the company asserts that the city "impermissibly treats Airbnb as the publisher or speaker of third-party content" when it is merely a platform for communications between property owners and guests.
Other online marketplaces - such as Amazon, eBay , and Craigslist - have cited the same law to shield themselves from liability for any improper transactions among users of their services.
Airbnb takes a cut of the revenue when a room or a home is booked and charges a service fee to guests. The company says it helps communities by enabling middle-class families to make extra money.
It also points to agreements with officials in nearly 200 locales around the world, mostly for tax collection and in some cases for broader short-term rental regulation.
Critics counter that, in popular tourist destinations, Airbnb takes affordable housing off the market, drives up home prices and disrupts neighbourhoods with streams of transient visitors.
Airbnb on Wednesday announced it would create an online registration system for property owners and automate the enforcement of Airbnb's existing rules in New York and San Francisco, which limit operators to a single listing of an entire residence.
New York assemblywoman Linda Rosenthal, sponsor of the New York legislation, was unimpressed by Airbnb's announcement.
"It's preposterous. Maybe half their listings are illegal" in New York City, she said. "It's part-and-parcel of the business model."
Existing New York state law bars most urban apartment-dwellers from renting out their units for less than 30 days if they are not present.
The law signed by Cuomo on Friday bars even advertising a rental that violates that existing law, which could help regulators crack down on Airbnb itself in addition to the users of its service.
In its court challenge, Airbnb said the statute penalises the company over content posted by users, which is prohibited by federal law.
Airbnb has also said it has taken down nearly 3000 illegal listings in New York City over the past year, and reports 44,622 total listings in the city as of September 1.
Critics contend that a large portion of Airbnb listings are offered by commercial operators with multiple properties who are essentially running illegal hotels. The company, they argue, has effectively turned many residential neighbourhoods into tourist zones.
In Los Angeles, a study by the pro-labour Los Angeles Alliance for a New Economy found that property owners with two or more listings generated 44 percent of all Airbnb revenue in Los Angeles.
Airbnb, in a statement, disputed that conclusion and called the group's analysis "misleading."