A judge is expected to order internet giant Google to turn over some search data to the US government, after the state reduced its previous demands.
Google said users of its search engine have a right to their privacy
But Judge James Ware told a hearing in California that he would weigh the government's need to gather data against the privacy of Google users.
The Justice Department says it needs access to Google search records to help prevent access to online pornography.
Google says complying with the request would compromise its business.
The US Justice Department had called for Google to hand over a week's worth of search records.
However, in court it reduced its request to just 50,000 web addresses and approximately 5,000 search terms.
Acknowledging that the state may have a right to know which websites are indexed by Google's search engine, Judge Ware said he was "particularly concerned" over the request for a random sample of search data.
He signalled his intention to grant some of the government's request in a written verdict expected soon.
During the hearing in San Jose, the judge questioned whether an internet search should be treated as a private act.
"People who go searching on the world wide web are, essentially, exposing for the world that they want the information," he said.
He told the Justice Department it could expect to get at least some of the information sought.
However, he expressed reservations about requiring the company to divulge some of its most sensitive data - the actual requests that people enter into its popular search engine.
Both sides appeared pleased with the judge's approach to the case.
"When the government was asked to justify their demand they conceded that they needed much less," Google lawyer Nicole Wong said outside court.
Charles Miller, of the Justice Department, said: "We hope his opinion will demonstrate the government's belief that this info would be helpful in protecting the nation's youth against potentially harmful material."
Head to head
The case has focused attention on the issue of personal information held by internet companies.
The US government is seeking to defend the 1998 Child Online Protection Act, which has been blocked by the Supreme Court because of legal challenges over how it is enforced.
It wants the data from the search engines to prove how easy it is to stumble over porn on the net.
Google's refusal was based on three main arguments.
Firstly, Google says it does not want to do the government's work for it and secondly it says that it wants to protect its product.
Thirdly, Google wants to show users that the company is serious about protecting their privacy.
Cooperating with the government "is a slippery slope and it's a path we shouldn't go down", Google co-founder Sergey Brin told industry analysts earlier this month.