Airbnb and Expedia Group’s HomeAway failed to persuade a U.S. court of appeals to strike down a Santa Monica law that makes the companies liable for illicit rentals in the Southern California beach city.

The ruling is a setback for the home-sharing platforms in their effort to avoid regulation by cities that blame the rapid proliferation of short-term rentals for a shortage of affordable housing and a disintegration of residential communities.