A federal appeals court has turned back a legal challenge that short-term rental websites Airbnb Inc. and HomeAway.com brought against a Santa Monica ordinance forcing them to collect local taxes and refrain from booking stays in properties not licensed and listed in the Southern California beach city’s registry.

The companies’ lawyers at Munger, Tolles & Olson and Davis Wright Tremaine had argued that the ordinance was pre-empted by the Communications Decency Act, which offers websites broad immunities from liability for content generated by third parties. They also argued that the ordinance restricted their commercial speech in violation of the First Amendment.