The U.S. Supreme Court on Friday concluded that police need warrants to gather phone location data as evidence. In the 5-4 ruling, the Court cited the Fourth Amendment’s guarantee to be free from unreasonable government searches as the reason for reversing and remanding the Sixth Circuit court’s decision, according to The Wall Street Journal.

Carpenter v. United States is the first case the Supreme Court has taken about phone location data. The dispute dates back to a 2011 robbery case in Detroit. The police gathered months of phone location data from Timothy Carpenter’s phone provider. In total, they collected 12,898 different locations from Carpenter, over 127 days.

Instead of seeking a warrant for the cell-site data, which would have required a showing of “probable cause,” prosecutors in the case sought the data under the Stored Communications Act, which only requires “reasonable grounds.”

The Wall Street Journal explains:

The legal and privacy concern was that police gathered the four months’ worth of Carpenter’s digital footprints without a warrant. A Sixth Circuit Court of Appeals judge ruled that cellphone location data is not protected by the Fourth Amendment, which forbids unreasonable search and seizure, and therefore didn’t require a warrant.

In writing for the majority, Chief Justice John Roberts said, “We decline to grant the state unrestricted access to a wireless carrier’s database of physical location information.”

Roberts, who likes applying constitutional protections to modern technology, was joined by Justices Ruth Bader Ginsburg, Stephen Breyer, Sonia Sotomayor, and Elena Kagan.

Conservative Justices Anthony Kennedy, Clarence Thomas, Samuel Alito and Neil Gorsuch filed four separate dissents.

Earlier this week in another 5-4 decision the Supreme Court said states could require online retailers to collect taxes. The decision reversed 50 years of legal rulings that barred states from imposing sales taxes when their residents made a purchase from an out-of-state retailer.