“The circumstances here certainly suggested criminal activity,” he wrote. “As explained, the officers found a group of people who claimed to be having a bachelor party with no bachelor, in a near-empty house, with strippers in the living room and sexual activity in the bedroom, and who fled at the first sign of police.”

In any event, he added, the officers were entitled to immunity from the lawsuit because there was no Supreme Court decision clearly establishing that the arrests were unlawful. In a concurring opinion, Justice Sonia Sotomayor joined only that part of Justice Thomas’s opinion.

Justice Ruth Bader Ginsburg also voted with the majority but did not embrace its reasoning. She suggested that the court should revise its approach to such cases. “The court’s jurisprudence, I am concerned, sets the balance too heavily in favor of police unaccountability to the detriment of Fourth Amendment protection,” Justice Ginsburg wrote.

The court also agreed to hear a case on the habitat of an endangered animal, the dusky gopher frog, in Weyerhauser Co. v. United States Fish and Wildlife Service, No. 17-71. In 2012, the federal government designated private land in Louisiana as “critical habitat” for the frog, limiting the ability of the owners to develop the land and by one account potentially costing them about $34 million.

The landowners argued that the designation makes no sense, as the frogs are not currently present and the land is not a suitable habitat for them in any event. “The frog does not live there, cannot live there, and will not live there in the future,” the landowners told the Supreme Court.

The government responded that the land was the best choice for an effort to protect the frog.

The landowners’ objection that their land “is not suited in all respects for immediate occupation by the frog,” the government’s lawyers wrote, “overlooks the substantial practical challenges inherent in the identification of critical habitat for endangered species. Many species are endangered precisely because their ideal habitat has been severely diminished or eliminated altogether.”

“Where optimal habitat is unavailable,” the brief said, “the service acts appropriately in prioritizing areas with those features that are rarest or most difficult to reproduce through human intervention — here, the unique ephemeral ponds necessary for the frog’s breeding — while ensuring that any deficiencies in those areas could be addressed with ‘reasonable effort.’ ”