Microsoft CEO Satya Nadella. Manish Swarup/AP

Microsoft CEO Satya Nadella has warned that society could regret sacrificing privacy for law enforcement, as his company fights a long-running battle with the US Department of Justice over accessing customer emails.

Nadella, speaking to reporters in London on Friday, acknowledged the ongoing case and said: "We're essentially litigating over this very issue. How can we carry out our responsibility to protect the privacy of our customers, whether individuals or organisations, and build trust, and at the same time recognise that there [are] national security needs in every government, and every country will care about safety of their citizens?"

Microsoft has been fighting the US government since 2014, when the justice department served the company with a subpoena for emails stored in Irish servers. Microsoft has refused, arguing that permission to access data stored abroad needs to be given by the overseas government.

Nadella said tech companies understood the need for national security, but added: "If in that context we sacrifice our enduring value around privacy, then I think as a society we will regret it."

He called for a "new framework of laws", which would account for the free flow of online information across national boundaries. He said current laws were created "for a different era."

So far, Microsoft is winning its fight against the government, but the department now wants the battle to go to the Supreme Court. As yet, the Supreme Court has not decided whether to take the case. If it rules against the company, the decision would have major implications for Microsoft and other tech giants.

Google was in a similar fight with the justice department but, according to Ars Technica, quietly stopped fighting government requests for overseas data.

Apple also battled the FBI over unlocking an iPhone used by the San Bernardino shooter and won — but only because the FBI found a way to access the device by itself.