NEW YORK -- U.S. law enforcement can force Microsoft Corp. to turn over emails it stores in Ireland, a judge ruled in a case that technology companies have rallied around as they pursue billions of dollars in data storage business abroad.

U.S. District Judge Loretta A. Preska ruled from the bench Thursday after hearing oral arguments in Manhattan.

She said she agreed with the findings of a magistrate judge who approved a sealed search warrant in December for a consumer email account that Microsoft stores in Dublin, Ireland. U.S. investigators were seeking the information as part of a narcotics investigation.

Get Breaking News Delivered to Your Inbox

Preska said it was a question of who controlled the data rather than where it was stored. The information could be produced by Microsoft in the United States without intruding on the foreign sovereignty of Ireland, she added.

A court or law enforcement agency in the United States is empowered to order a person or entity to produce materials, even if the information or person possessing the information is outside the U.S., Preska said.

The Redmond, Washington-based software company has said rulings forcing it to turn over emails threaten to rewrite the Constitution's protections against illegal search and seizure and could damage U.S. foreign relations. Its arguments were joined by large technology companies, including Apple Inc., Cisco Systems Inc., Verizon Communications Inc. and AT&T Inc.

The judge stayed the effect of her ruling to give the company time to appeal.

Brad Smith, Microsoft's general counsel and executive vice president, said in a statement that Preska's ruling was not the final word.

"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.

E. Joshua Rosenkranz, Microsoft's attorney, had argued unsuccessfully Thursday that the search warrant amounted to the extension of U.S. law enforcement authority to another country.

He said it also increased the likelihood that other countries would try to access information in the United States.

Rosenkranz said authorities in China had appeared at Microsoft offices there this week demanding a password to access material that the company stores in the United States.

Preska said the actions in China sounded "pretty scary to me" and asked for a response from Assistant U.S. Attorney Serrin Andrew Turner.

Turner said the possibility of retaliation by other nations existed, but that it was a diplomatic issue. He said lawyers in the case had cited no laws in Ireland that would forbid Microsoft from turning over the data.

In court documents, Microsoft said it offers so-called cloud services in more than 100 countries and tries to keep a customer's data - including email, calendar entries and documents - in a data center near where the customer is located for easy and cost-effective access. Microsoft maintains data centers worldwide, including in the United States, Ireland, the Netherlands, Japan and Brazil.