The Supreme Court has struck down a Los Angeles ordinance that permits the police to check guest registries at motels and hotels at any hour of the day or night.

The 5-4 decision upheld a ruling of the U.S. 9th Circuit Court of Appeals that vacated the law, saying it authorized unreasonable searches.

Most cities require the operators of a hotel or motel to keep a guest registry available for inspection, said the LA Times. The Los Angeles city attorney's office said some of these motels become havens for prostitution, sex trafficking and drug dealing. Police officers need the authority to conduct spot checks, the city said.

"A group of motel owners went to court, alleging that the spot checks late at night were intrusive and disruptive for families running the motels. The group won a broad ruling from the 9th Circuit Court that held the ordinance unconstitutional," said the LA Times. 

Justice Sonia Sotomayor said motel owners deserve the right to go to a judge and to object before a search takes place. "We hold that the provision of the Los Angeles Municipal Code that requires hotel operators to make their registries available to the police on demand is facially unconstitutional because it penalizes them for declining to turn over their records without affording them any opportunity for precompliance review," she said in Los Angeles vs. Patel.

Justices Anthony M. Kennedy, Ruth Bader Ginsburg, Stephen G. Breyer and Elena Kagan said police may obtain a search warrant if they suspect criminal activity at a motel or hotel.

Read more: http://www.latimes.com/nation/la-na-supreme-court-motels-los-angeles-20150622-story.html