SAN FRANCISCO (Reuters) - The U.S. government is trying to force Facebook Inc FB.O to break the encryption in its popular Messenger app so law enforcement may listen to a suspect's voice conversations in a criminal probe, three people briefed on the case said, resurrecting the issue of whether companies can be compelled to alter their products to enable surveillance.

The previously unreported case in a federal court in California is proceeding under seal, so no filings are publicly available, but the three people told Reuters that Facebook is contesting the U.S. Department of Justice’s demand.

The judge in the Messenger case heard arguments on Tuesday on a government motion to hold Facebook in contempt of court for refusing to carry out the surveillance request, according to the sources, who spoke on condition of anonymity.

Facebook and the Department of Justice declined to comment.

The Messenger issue arose in Fresno, California, as part of an investigation of the MS-13 gang, one of the people said.

U.S. President Donald Trump frequently uses the gang, which is active in the United States and Central America, as a symbol of lax U.S. immigration policy and a reason to attack so-called “sanctuary” laws preventing police from detaining people solely to enforce immigration law.

Trump called members of the gang “animals” this year when the Sheriff of Fresno County complained that California laws limited her co-operation with federal immigration enforcement targeting gang members.

The potential impact of the judge’s coming ruling is unclear. If the government prevails in the Facebook Messenger case, it could make similar arguments to force companies to rewrite other popular encrypted services such as Signal and Facebook’s billion-user WhatsApp, which include both voice and text functions, some legal experts said.

Law enforcement agencies forcing technology providers to rewrite software to capture and hand over data that is no longer encrypted would have major implications for the companies which see themselves as defenders of individual privacy while under pressure from police and lawmakers.

Attendees walk past a Facebook Messenger logo during Facebook Inc's annual F8 developers conference in San Jose, California, U.S. May 1, 2018. REUTERS/Stephen Lam/File Photo

Similar issues came into play during a legal fight in 2016 between the Federal Bureau of Investigation and Apple Inc AAPL.O over access to an iPhone owned by a slain sympathizer of Islamic State in San Bernardino, California, who had murdered county employees.

WIRETAP OF VOICE CONVERSATIONS

In the Apple case the company argued that the government could not compel it to create software to breach the phone without violating the company’s First Amendment speech and expression rights. The government dropped the litigation after investigators got into the phone with a contractor’s help.

Unlike the San Bernardino case, where the FBI wanted to crack one iPhone in its possession, prosecutors are seeking a wiretap of ongoing voice conversations by one person on Facebook Messenger.

Facebook is arguing in court that Messenger voice calls are encrypted end-to-end, meaning that only the two parties have access to the conversation, two of the people briefed on the case said.

Ordinary Facebook text messages, Alphabet Inc's GOOGL.O Gmail, and other services are decrypted by the service providers during transit for targeted advertising or other reasons, making them available for court-ordered interception.

End-to-end encrypted communications, by contrast, go directly from one user to another user without revealing anything intelligible to providers.

Facebook says it can only comply with the government’s request if it rewrites the code relied upon by all its users to remove encryption or else hacks the government’s current target, according to the sources.

Legal experts differed about whether the government would likely be able to force Facebook to comply.

Stephen Larson, a former judge and federal prosecutor who represented San Bernardino victims, said the government must meet a high legal standard when seeking to obtain phone conversations, including showing there was no other way to obtain the evidence.

Still, the U.S. Constitution allows for reasonable searches, Larson said, and if those standards are met, then companies should not be able to stand in the way.

A federal appeals court in Washington D.C. ruled in 2006 that the law forcing telephone companies to enable police eavesdropping also applies to some large providers of Voice over Internet Protocol, including cable and other broadband carriers servicing homes. VoIP enables voice calls online rather than by traditional circuit transmission.

However, in cases of chat, gaming, or other internet services that are not tightly integrated with existing phone infrastructure, such as Google Hangouts, Signal and Facebook Messenger, federal regulators have not attempted to extend the eavesdropping law to cover them, said Al Gidari, a director of privacy at Stanford University Law School’s Center for Internet and Society.

“A messaging platform is excluded,” maintains Gidari, who is not involved in the Fresno case.