In a landmark privacy decision, the Supreme Court ruled 5-4 on Friday that police must get a warrant in order to obtain your cellphone’s location data over an extended period of time.

The decision is a major victory for privacy advocates, who have long argued that the law has failed to keep pace with the amount of intrusive data we voluntarily hand over to private companies.

Chief Justice John Roberts joined the liberal justices on the court, declaring that even though the data is held by a third party, the government still needs a warrant to obtain it.

“We decline to grant the state unrestricted access to a wireless carrier’s database of physical location information,” said Roberts, writing for the majority. “In light of the deeply revealing nature of [cell-site location information], its depth, breadth, and comprehensive reach, and the inescapable and automatic nature of its collection, the fact that such information is gathered by a third party does not make it any less deserving of Fourth Amendment protection.”

The court made the ruling in the case of Timothy Carpenter, who was convicted in 2013 of robbing Radio Shack and T-Mobile stores in Michigan and Ohio. In order to build their case, the FBI obtained 127 days’ worth of location information for Carpenter’s cellphone – almost 12,900 location points – which they used to place him at the scene of the robberies.

The FBI obtained the data under the Stored Communications Act, which allowed them to acquire it directly from Carpenter’s wireless provider without obtaining a warrant based on probable cause. According to disclosures by phone companies, police across the country make these types of requests tens of thousands of times per year.

When the case was argued in November, the government’s position was largely based on an old idea in Fourth Amendment law called the “third-party doctrine.” The Supreme Court expressed that idea in a famous ruling in 1979 that allowed police to obtain without a warrant a list of phone numbers dialed by an individual. The theory underlying that decision was that callers surrender their expectation of privacy when they hand that information over to a phone company.

But Friday’s ruling suggests that that opinion doesn’t apply to cellphone location information, which the court considers more intrusive.

“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,” wrote Chief Justice Roberts.

Friday’s decision was made on narrow grounds, and the court did not examine potential implications for other technologies, like surveillance cameras, facial-recognition technology, or other types of phone or internet data. The court also declined to rule on whether obtaining real-time location data from a cellphone qualified as a search under the Fourth Amendment, and left open the possibility that the government could access less than seven days’ worth of location information without a warrant.

Jake Laperruque, senior counsel at the Project on Government Oversight, said that the decision was a massive step forward, but expressed disappointment that the court did not address the possibility of real-time tracking.

“[By] refusing to make this obvious extension of its ruling, the Court [has] prolonged this fight for years, and it left us unprotected from extremely invasive tools like stingrays that should clearly require a warrant,” Laperruque told The Intercept in an email.

The American Civil Liberties Union hailed the decision, saying it would open the door to updating privacy law for a range of technologies. “This is a groundbreaking victory for Americans’ privacy rights in the digital age,” ACLU attorney Nathan Wessler, who argued the case in November, said in a statement. “The Supreme Court has given privacy law an update that it has badly needed for many years, finally bringing it in line with the realities of modern life. The government can no longer claim that the mere act of using technology eliminates the Fourth Amendment’s protections.”

Top photo: Cherry blossoms frame the U.S. Supreme Court building on April 10, 2018.