HomeAway, the nation’s largest vacation-home rental site, on Monday filed suit against San Francisco saying its new law to regulate short-term rentals in private homes unfairly benefits Airbnb at the expense of HomeAway and other rivals.

The suit says the law violates the U.S. Constitution by creating a burden on interstate commerce and asks the U.S. District Court for Northern California to throw out two key provisions of the measure before it takes effect on Feb. 1, 2015.

“It is shocking the Supervisors passed a law that, in our opinion, stifles opportunity in such a discriminatory manner,” Carl Shepherd, co-founder of HomeAway, said in a statement. “In its apparently single-minded goal to ‘legalize Airbnb,’ we claim the Supervisors ignored the benefits of responsibly regulating a well-established industry, and embraced an unconstitutional and unenforceable regulation.”

City Attorney Dennis Herrera said in a statement that the lawsuit is without merit.

“I intend to vigorously defend a law that offers San Francisco residents reasonable flexibility to rent their homes on an occasional basis,” he wrote. “HomeAway’s challenge pushes a dubious legal theory that the U.S. Constitution’s Commerce Clause somehow prohibits local jurisdictions from making local land use decisions. San Francisco is well within its authority to ensure that scarce housing resources are used primarily for housing.”

Short-term rentals have long been illegal in San Francisco, but the city only loosely enforced that law As sites like Airbnb, with almost 5,000 listings in San Francisco, and HomeAway/VRBO, with 1,200, became popular, concerns grew that the lucrative vacation rentals were siphoning off permanent housing, and changing neighborhoods. Board of Supervisors President David Chiu spent two years drafting a law to legalize and rein in the rentals, which the supervisors passed 7-4 and Mayor Ed Lee signed last week.

The law has already engendered plenty of controversy with California Sen. Dianne Feinstein coming out against it, and a group with backing from housing activists and landlords planning a 2015 ballot measure seeking a more-stringent law. Political observers noted that the lawsuit was filed on the eve of a bitterly fought election battle between Chiu and fellow Supervisor David Campos for a seat in the state legislature.

The new law says only permanent residents of San Francisco can rent their homes to short-term travelers. But most of the 1,200 San Francisco listings on HomeAway and its subsidiary VRBO are second homes, whose owners don’t live here year-round. HomeAway wants the permanent resident requirement tossed.

“The permanent residency requirement is the key to trying to prevent the cannibalization of our housing stock” into vacation rentals, said Judson True, Chiu’s legislative aide.

HomeAway’s Shepherd previously told The Chronicle that it is “naive” to think that vacation-home owners would turn those second residences into permanent housing if they were barred from renting them short-term, and that he thought the new law had been crafted expressly for Airbnb’s business model.

The law also says that vacation-rental platforms have to collect and remit San Francisco’s 14 percent hotel tax, something that Airbnb started doing in October, although it’s been mum about any plans to pay an estimated $25 million in back taxes. But HomeAway and VRBO function differently than Airbnb, acting as classified-listing services rather than middlemen, which means they don’t have the ability to collect the hotel tax — or even to know when homes were rented out via their sites.

True’s response to that: “It’s offensive that any short-term rental company wouldn’t want to make sure San Francisco gets the tax revenue it deserves.”

“Our goal is to work with the city to amend the law to one that balances the needs of the community with the rights of all people to rent their properties, regardless of who they are, where they choose to live and how they choose to market those properties,” says Shepherd. “We expected any ordinance in San Francisco would be thought-leading public policy, but instead it fails on all counts resulting from a desire to anoint winners and losers, not to create policies that are fair to all.”