Law enforcement must generally obtain a warrant before searching the contents of a cellphone that belongs to a person under arrest, the U.S. Supreme Court said on Wednesday in a major ruling on digital privacy.

The court said warrantless searches of mobile devices are permitted under limited circumstances under the Fourth Amendment. Chief Justice John Roberts Jr. delivered the unanimous opinion for the court.

“The fact that an arrestee has diminished privacy interests does not mean that the Fourth Amendment falls out of the picture entirely,” Roberts wrote.

Cellphones, Roberts wrote, “are not just another technological convenience.” Mobile devices, he said, “hold for many Americans the ‘privacies of life.’”

“The fact that technology now allows an individual to carry such information in his hand does not make the information any less worthy of the protection for which the Founders fought,” Roberts wrote. “Our answer to the question of what police must do before searching a cell phone seized incident to an arrest is accordingly simple—get a warrant.”

Roberts disputed the government’s position that the search of data on a mobile phone is “materially indistinguishable” from searches of other physical items. “That is like saying a ride on horseback is materially indistinguishable from a flight to the moon,” Roberts wrote. “Both are ways of getting from point A to point B, but little else justifies lumping them together.”

The justices said the police are not “without specific means” to address their concern about the remote wiping of a cellphone to remove evidence. “Remote wiping can be fully prevented by disconnecting a phone from the network,” Roberts wrote. The authorities, he said, can turn the phone off or remove its battery.

Roberts wrote: “We cannot deny that our decision today will have an impact on the ability of law enforcement to combat crime. Cell phones have become important tools in facilitating coordination and communication among members of criminal enterprises, and can provide valuable incriminating information about dangerous criminals. Privacy comes at a cost.”

The rulings came in the cases of Riley v. California and United States v. Wurie.

In the California case, San Diego police in 2009 detained David Riley for driving with expired tags. Police searched the car and found two concealed firearms and seized Riley’s smartphone without a warrant. Stored text messages as well as photos and video led police to believe Riley had gang connections and was involved in prior gang-related crimes.

The other case originated in Boston, where police in 2007 arrested Brima Wurie on drug-trafficking charges. Without first obtaining a warrant, officers went through the call log on his older-model “flip phone” and saw numerous calls from a number labeled “my house.”

Using a reverse directory, they traced the address, obtained a warrant to search the house and found illegal drugs and firearms. In both cases the defendants sought to suppress the evidence at trial.

Justices raised similar privacy concerns during the separate arguments in both cases in April. But the court seemed somewhat less worried about police searching limited-capacity flip phones for phone numbers than they were about smartphones, because of the vast range of data the devices hold.

Justice Elena Kagan, the court’s youngest member at age 54, said at one point, “Most people now do carry their lives on cellphones.”

Stanford Law School professor Jeffrey Fisher, who represented Riley, faced off against California Solicitor General Edward DuMont. Deputy U.S. Solicitor General Michal Dreeben represented the federal government in both cases, and assistant federal public defender Judith Mizner argued on behalf of Wurie.

The government lawyers argued that a ruling forcing police to obtain search warrants in all or most cases would jeopardize safety and give criminal suspects time to encrypt or wipe out important information.

Contact Mike Scarcella at mscarcella@alm.com. Tony Mauro contributed to this article.