By MARTHA BELLISLE, Associated Press

SEATTLE (AP) — A judge refused the U.S. government's request to throw out a lawsuit from Microsoft that claims a federal law is unconstitutional because it prohibits technology companies from telling customers when the government demands their electronic data.

U.S. District Judge James Robart, who temporarily blocked President Donald Trump's travel ban last week, agreed with Microsoft that the law violates the company's First Amendment right to speak to its customers when their private information is collected during criminal investigations.

But Robart denied its claim that the law violates customers' rights against unreasonable searches and seizures, saying a third party like Microsoft can't assert constitutional rights for someone else.

The case will now head to trial, where Microsoft will argue that "people need to get notice when the government comes knocking at the door to seize all that stuff that historically would have been stored in a file cabinet," Microsoft lawyer Stephen Rummage said during a recent hearing.

The Electronic Communications Privacy Act compels companies to divulge data stored in "third-party computers," such as Microsoft's Cloud, and keep the move secret. Microsoft successfully argued that the law harms the company by eroding customer confidence in its cloud services, Robart said in the ruling published Thursday.

"Government surveillance aided by service providers creates unique considerations because of the vast amount of data service providers have about their customers," Robart said.

The service providers know the websites we visit, Google keeps records of our searches and Facebook keeps records of our friends and what we "like," he said. Several court cases have found that material deserves constitutional protection, he said.

Microsoft President Brad Smith said the company is pleased with the order.

"This ruling enables our case to move forward toward a reasonable solution that works for law enforcement and ensures secrecy is used only when necessary," Smith said.

Nicole Navas, a Justice Department spokeswoman, said the agency is reviewing the decision and declined to comment.

Microsoft sued last year saying the government has increasingly sought to obtain information from providers instead of customers. Federal courts have issued more than 3,250 secret orders for data over a 20-month period ending May 2016 and more than 450 of those orders had no end dates, the company said.

One magistrate judge in southern Texas reported that the Electronic Privacy Act docket "handles tens of thousands of secret cases every year," Robart's order said.

Companies including Apple, Twitter and Amazon as well as media outlets such as The Associated Press, the Seattle Times and Washington Post filed court briefs supporting Microsoft.

The Justice Department filed a motion to dismiss, arguing that the government has an interest in keeping criminal investigations confidential and customers often eventually learn about the data demands when charges are filed.

___

Follow Martha Bellisle at https://twitter.com/marthabellisle