The U.S. government is trying to force Facebook 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.

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