Microsoft has been told it must handover emails stored abroad to US prosecutors by a New York court. However, the software giant says it will fight the ruling, saying that an email deserves the same privacy protection as a paper letter sent by mail.

The company says they will not release any emails to US authorities, while it appeals the ruling, made by Chief Judge Loretta Preska of the US District Court in Manhattan. She said that Microsoft must hand over information, regardless of where it was stored.

"Microsoft will not be turning over the email and plans to appeal,” a Microsoft spokesperson told Reuters. "Everyone agrees this case can and will proceed to the appeals court. This is simply about finding the appropriate procedure for that to happen."

Preska says her decision is final, but she will allow Microsoft to appeal the ruling and as asked both parties to give their planned courses of action by September 5. This case appears to be the first of its kind in which a corporation is challenging a US search warrant to obtain data being held overseas.

READ MORE: German ‘NSA-proof’ private server raises $1mn crowdfunding in 89 minutes

The original July 31 ruling concerned a warrant prosecutors served on Microsoft for an individual's emails stored in Dublin, Ireland. A magistrate judge in April ruled the warrant was valid.

Tech companies are not happy about the ruling as they gain revenue by storing foreign emails abroad, which they believed were out of the jurisdiction of the US authorities. However, the ruling by the New York court has changed this and if the appeal by Microsoft is unsuccessful, US law enforcement agencies would in theory be able to seize any data they wished.

“Earlier this month, the British government passed a law asserting its right to require tech companies to produce emails stored anywhere in the world. This would include emails stored in the US by Americans who have never been to the UK,” Brendon Lynch, Chief Privacy Officer for Microsoft, wrote in his blog.

Lynch says Microsoft is committed to delivering meaningful privacy protections, which build trust with the customers. “We believe your email belongs to you, not us, and that it should receive the same privacy protection as paper letters sent by mail – no matter where it is stored,” he said.

“While we appreciate the vital importance of public safety, we believe it’s also important to strike the right balance with the privacy concerns of people who use technology. A recent poll shows most Americans agree,” Lynch added.

READ MORE: NSA can easily bug your switched-off iPhone: Here's how you can stop them

The poll, which was conducted by public opinion research firm of Anzalone Liszt in July, says that 79 percent agree that the federal government should have to respect local privacy laws when searching through people’s personal information like their email accounts. It also shows that 86 percent think police should have to follow the same legal requirements for obtaining personal information stored in the cloud as they do for personal information stored on paper.

Microsoft is particularly wary about data security following revelations by former National Security Agency contractor Edward Snowden that the US government was collecting massive amounts of data from around the world. It has since been trying to reassure its customers that it does not allow the US government unrestricted access to personal documents that are stored on its servers.