A federal judge in Manhattan ruled on Thursday that three labor unions can proceed with a lawsuit accusing the State and Homeland Security departments of surveilling the social media accounts of noncitizens in order to punish views the government disfavors.

Judge Alvin K. Hellerstein of the Federal District Court in Manhattan denied the government’s motion to dismiss the suit, which the United Automobile Workers, the Communications Workers of America and the American Federation of Teachers filed in October 2025. The unions are represented by the Electronic Frontier Foundation, Muslim Advocates and the Media Freedom and Information Access Clinic, which announced the decision.

The lawsuit contends that since taking power, the Trump administration has built a mass surveillance program that uses A.I. and other automated tools to monitor the accounts of visa and green card holders lawfully in the United States, identifying people who express viewpoints the government disfavors. The monitoring, the unions say, has been paired with a public intimidation campaign that has chilled not only noncitizens but the families, co-workers and friends around them, and it violates the First Amendment and the Administrative Procedure Act.

Judge Hellerstein found that the unions had plausibly claimed harm to their members and to their own ability to organize. “This threat of adverse immigration consequences, under a government whose harsh immigration crackdowns has been heavily publicized and reported on, is certainly enough to ‘deter a person of ordinary firmness from the exercise of First Amendment rights,’” he wrote. A program alleged to silence members and drive them from the rolls, he wrote, “strikes at the unions’ representational function itself.”

Union leaders welcomed the decision. “No one should have to fear government surveillance or retaliation against their immigration status for expressing their views or participating in their union,” Shawn Fain, the U.A.W. president, said in a statement. Randi Weingarten, the A.F.T. president, said the ruling was “a critical step toward vindicating our Constitutional right to freedom of speech” and that government surveillance of the opposition “is a tool of dictators.” Claude Cummings Jr., the C.W.A. president, called the decision “a victory for working people, for the labor movement, and for our democracy.”

Lisa Femia, a senior staff lawyer at the Electronic Frontier Foundation, said members of the plaintiff unions “have wholly changed the way they interact with social media” because of the program, limiting their engagement with union content, stopping joint posts and even avoiding offline activities for fear of being targeted over immigration benefits.

The departments had sought dismissal on what Nick Jones, a student in the media freedom clinic, called “specious jurisdictional grounds.” The case now proceeds to the merits. “We expect to prevail as well,” Mr. Jones said in a statement.