A federal court has struck down a Los Angeles law it says wrongly allows police to inspect hotel and motel guest records without a warrant.

The 9th U.S. Circuit Court of Appeals opinion released Tuesday says the ordinance violates the constitutional ban on unreasonable searches. It reversed a lower court that sided with the city in a challenge brought by two motel owners.

The five-judge majority said hotels ordered to produce the records or face possible misdemeanor charges must have a chance to let a judge review the demand.

In their dissent, four judges said that the majority wrongly assumed that all searches made under the ordinance were unconstitutional.

The L.A. city attorney's office said it may issue a comment about the ruling later Tuesday. A spokesman for the office told KPCC that they are"reviewing the decision and assessing all our options."