The Supreme Court heard arguments for the first time Wednesday about whether police can obtain cellphone location records without a warrant, setting up the possibility for legal precedent that could affect privacy law for generations.

Experts have said the case could have consequences far beyond location tracking by law enforcement – it could impact National Security Agency surveillance and even help outline how courts should handle privacy concerns as technology evolves.

The case, Carpenter v. United States, stems from the case of Timothy Carpenter and Timothy Sanders, who were convicted in 2013 of robbing Radio Shack and T-Mobile stores in Michigan and Ohio.

During its investigation into the robberies, the FBI sought information from the suspects’ cellphone service providers to place them at the scene of the crime. But rather than obtain a warrant, the agency requested the data under the Stored Communications Act, which applies to electronic communications stored by third-party service providers and has a lower standard of evidence than the Fourth Amendment requirement for a search warrant. The FBI also requested cellphone location data for a 127-day period — instead of just the days on which the robberies occurred — allowing federal law enforcement agents to precisely map the men’s movements over a period of four months.

Much of Wednesday’s argument focused on whether the men had a reasonable expectation of privacy regarding their whereabouts over such an extended period.

“Nobody has expected in a free society that our longer-term locations will be aggregated and tracked in the way that they can be here,” said Nate Wessler, an American Civil Liberties Union lawyer who represents Carpenter. “Longer-term periods or aggregations of cell site location information is a search, and requires a warrant.”

Michael Dreeben, the Justice Department’s deputy solicitor general, argued instead that the cellphone service providers that collect data are more like witnesses to a crime, and that the government can request information from them if it has a reasonable suspicion a crime has been committed.

“The technology here is new, but the legal principles that this court has articulated under the Fourth Amendment are not,” said Dreeben.

During the argument, Justice Sonia Sotomayor, a liberal, seemed sympathetic to Wessler’s arguments about how intrusive cellphone tracking can be. “I know that most young people have the phones in the bed with them,” Sotomayor said, to laughter from the audience in the packed courtroom. “I know people who take phones into public restrooms. … It’s an appendage now for some people. ”

The case is about much more than cell-site records; it requires the Supreme Court to scrutinize one of the basic tenets of surveillance law – what lawyers call the “third-party doctrine.” The decades-old doctrine is based on the idea that people forfeit their expectation of privacy under the Fourth Amendment when they voluntarily hand over information to private companies, like banks and telecom and internet companies. When the government is investigating a criminal suspect, it can then obtain information from the third party without a warrant.

The doctrine has its origins in a 1979 Supreme Court case, in which the court ruled that police did not need a warrant to obtain a list of numbers that called a certain phone. Since the information appeared on a monthly phone bill, the court reasoned at the time, the government was simply requesting information people consented to hand over.

That idea formed part of the legal underpinning for a now-defunct NSA surveillance program that the agency used to collect the phone records of every American in bulk. After NSA whistleblower Edward Snowden revealed the existence of the program in 2013, Congress passed a law to amend it in 2015.

Wednesday’s case asks the court to re-examine the third-party doctrine in a fundamental way. Lawyers for Carpenter conceded that he agreed to have his location tracked by his cellphone provider, but said it was entirely different for the police to access that data over a sustained period of time and to use that to piece together a picture of someone’s life.

At Wednesday’s argument, Trump appointee Justice Neil Gorsuch pressed Dreeben on the limits of the third-party doctrine, especially when privacy and property interests are involved. “Isn’t that exactly your argument here — that so long as a third party’s involved, we can get anything we want?” Gorsuch asked, suggesting he thought there should be some limit on the government’s ability to obtain personal information.

Carpenter is the Supreme Court’s second exploration of the intersection of cellphone technology and the Fourth Amendment. In a 2014 case called Riley v. California, the court unanimously ruled that police must obtain a warrant to search the information on the cellphone of a person who has been arrested. Chief Justice John Roberts wrote in the Riley opinion that cellphones are such as “pervasive and insistent part of daily life that the proverbial visitor from Mars might conclude they were an important feature of human anatomy.”

On Wednesday, the justices seemed to agree that Carpenter could have significant implications for how law enforcement agencies collect other types of information. Justice Stephen Breyer questioned Wessler about how the outcome of the case could affect future cases involving bank records and noted the ramifications could be big.

“This is an open box. We know not where we go,” Breyer said.