San Francisco has picked a fight with Airbnb that it probably can’t win.

On Monday, the home-rental business filed a lawsuit against its hometown, saying that San Francisco’s attempt to get Airbnb to help enforce its housing law is illegal. Airbnb has reluctantly gone along with the city’s efforts to regulate the short-term rental market. As it stands, people can rent out their apartments with some restrictions, but they must also register with the city. Enforcing this law has been tricky, so the city’s Board of Supervisors recently passed an update saying websites like Airbnb can be punished if the people listing homes on their sites haven’t registered with the city.

Starting next month, Airbnb will face fines of up to $1,000 per day for each unverified listing, and its employees could also face jail time. But it seems unlikely to get that far, according to many attorneys who follow internet law. Websites like Airbnb have immensely broad protections against attempts to hold them liable for the actions of their users. Airbnb’s suit cites section 230 of the Communications Decency Act, widely considered the most revered law among internet companies. It’s the legal protection that keeps Google from being held responsible for the actions of websites its search engine points to and that lets eBay and Amazon run expansive marketplaces where they don’t have complete control over the vendors using their sites.

While Airbnb sets some rules over the people who use its website, the company is allowed to push pretty much all legal liability onto the users themselves. “Imagine if a state or city required eBay to verify that its sellers had the appropriate local business license,” said Eric Goldman, a professor at Santa Clara University School of Law, and an expert in online legal issues. “That would be an indirect, but very clear, limitation on eBay’s abilities to accept listings, and I think that’s what Section 230 precludes.”

The law explicitly excluded copyright violation and federal criminal liability from its purview. Other than that, it’s pretty much open season. Courts have repeatedly sided with companies in Airbnb’s position, including websites whose users sold fake autographed sports souvenirs, defamed other users and posted sexually explicit photographs of minors.

One notable case where a website went too far involved a feature on Roommates.com, where people created personal profiles by selecting their gender and race from a series of dropdown menus, then allowing people to filter out, say, black women. Asking such questions violates federal anti-discrimination laws, and a court found that Roommates.com essentially forced people into an illegal situation. But this exception is essentially an illustration of how far the law goes, said Clay Calvert, the director of the Marion B. Brechner First Amendment Project at the University of Florida. “You have to actually show that it requires you to do something illegal,” he said.

In a blog post, Airbnb referred to the law as the “linchpin of the vibrant and successful internet we know today.” By all accounts, San Francisco will face a challenging road convincing a judge that its new policy doesn’t run afoul of the rule.

This doesn’t necessarily mean that local laws aren’t a big problem for Airbnb. Its users can still be punished, and Airbnb says that the city has already levied about $700,000 in fines against its hosts. At some point, such fines could have a chilling effect that damages the entire Airbnb economy. On the same day the company filed its suit in San Francisco, Airbnb sent an e-mail to users in New York urging them to pressure Governor Andrew Cuomo into vetoing a law that would punish hosts in that state. But for now, the company suggests that San Francisco continues to go after users who aren’t complying. “Instead of punishing Airbnb for publishing unlawful listings, the city could enforce its short-term rental law directly against hosts who violate it,” Airbnb says in its suit.

Airbnb left that part out of its blog post.