A federal judge ruled Thursday that Microsoft must turn over to the U.S. government a customer's emails stored in servers overseas, in an unprecedented case that could have wide-ranging effects on the digital privacy rights of both Americans and foreigners using U.S. email services.

Judge Loretta Preska of U.S. District Court in Manhattan upheld the decision of a magistrate judge after hearing oral arguments from Microsoft and the federal government. In December, the government obtained a search warrant requesting the data of a single Outlook.com account. But the company refused to hand it over, arguing that it was not compelled to do so because the emails were actually stored in a server in Ireland and thus outside the purview of the U.S. government.

Microsoft argued that the search warrant didn't reach overseas, that the request threatened the Constitution's protections against illegal search and seizure, and that the case could even damage U.S. foreign relations. Apple, Cisco, Verizon and AT&T all filed briefs in support of Microsoft's arguments.

The U.S. government, for its part, argued that the warrant was valid in this case since it was a "hybrid" between a warrant and a subpoena, and subpoenas have reach outside the country according to American law.

Brad Smith, Microsoft's general counsel, announced that the company would appeal the decision.

We will appeal promptly & continue to advocate that people’s email deserves strong privacy protection in the U.S. & around the world. — Brad Smith (@BradSmi) July 31, 2014

"The only issue that was certain this morning was that the District Court’s decision would not represent the final step in this process. We will appeal promptly and continue to advocate that people’s email deserves strong privacy protection in the U.S. and around the world," he said in a statement.

Microsoft won't have to turn over the emails just yet, as Preska agreed to stay the effect of her ruling to give the company time to appeal.

Most details about the underlying case are currently unknown. The investigation apparently involves allegations of drugs and money laundering, but the name of the account holder is still not public, and it's unknown whether he or she is an American or European citizen. But big U.S. email providers store data closest to the user, to improve speed and service, according to industry experts, which would suggest that the target in this case may be a European resident.

This is the first time that an American tech company has challenged a federal government request to access data overseas, so the case could have important implications for future cases, experts say.

"This is just another instance of U.S. government policies that cause people to question the security of the data that they've stored with U.S. companies," Christopher Sprigman, a law professor at New York University, told Mashable in June.

The fundamental issue in this case is: What jurisdiction does data in the cloud fall under? What laws govern data in the cloud?

Microsoft argues that it if loses this case, nothing is stopping China from asking a U.S. company with no servers inside China to turn over some users' data.

As the company wrote in a brief in June:

The government’s position, if upheld, will end up harming U.S. citizens’ privacy interests because it will invite prosecutors abroad to conduct themselves in the same way, ignore treaty obligations, and serve some form of unilateral process on Microsoft in their countries to obtain U.S. citizens’ data stored in the United States.

Additional reporting by the Associated Press