The Supreme Court ruled Friday that police generally need a search warrant if they want to track criminal suspects’ movements by collecting information about where they’ve used their cellphones, bolstering privacy interests in the digital age.

The justices’ 5-4 decision marks a big change in how police may obtain cellphone tower records, an important tool in criminal investigations.

Chief Justice John Roberts, joined by the court’s four liberals, said cellphone location information “is detailed, encyclopedic and effortlessly compiled.” Roberts wrote that “an individual maintains a legitimate expectation of privacy in the record of his physical movements” as they are captured by cellphone towers.

Roberts said the court’s decision is limited to cellphone tracking information and does not affect other business records, including those held by banks.

He also wrote that police still can respond to an emergency and obtain records without a warrant.

Justices Anthony Kennedy, Samuel Alito, Clarence Thomas and Neil Gorsuch each wrote dissenting opinions. Kennedy wrote that the court’s “new and uncharted course will inhibit law enforcement” and “keep defendants and judges guessing for years to come.”

The court ruled in the case of Timothy Carpenter, who was sentenced to 116 years in prison for his role in a string of robberies of Radio Shack and T-Mobile stores in Michigan and Ohio. Cell tower records that investigators got without a warrant bolstered the case against Carpenter.

Investigators obtained the cell tower records with a court order that requires a lower standard than the “probable cause” needed to obtain a warrant. “Probable cause” requires strong evidence that a person has committed a crime.

The judge at Carpenter’s trial refused to suppress the records, finding no warrant was needed, and a federal appeals court agreed. The Trump administration said the lower court decisions should be upheld.

The American Civil Liberties Union, representing Carpenter, said a warrant would provide protection against unjustified government snooping.

The administration relied in part on a 1979 Supreme Court decision that treated phone records differently than the conversation in a phone call, for which a warrant generally is required.

“The government’s position fails to contend with the seismic shifts in digital technology that made possible the tracking of not only Carpenter’s location but also everyone else’s, not for a short period but for years and years,” Roberts wrote.

The earlier case involved a single home telephone and the court said then that people had no expectation of privacy in the records of calls made and kept by the phone company.

“The government’s position fails to contend with the seismic shifts in digital technology that made possible the tracking of not only Carpenter’s location but also everyone else’s, not for a short period but for years and years,” Roberts wrote.

The court decided the 1979 case before the digital age, and even the law on which prosecutors relied to obtain an order for Carpenter’s records dates from 1986, when few people had cellphones.

The Supreme Court in recent years has acknowledged technology’s effects on privacy. In 2014, the court held unanimously that police must generally get a warrant to search the cellphones of people they arrest. Other items people carry with them may be looked at without a warrant, after an arrest.