BOSTON >> A federal judge Thursday blocked the Trump administration from withholding billions of dollars in transportation funds from states that don’t agree to participate in some immigration enforcement actions.

Twenty states sued after they said Transportation Secretary Sean Duffy threatened to cut off funding to states that refused to comply with President Donald Trump’s immigration agenda. U.S. District Judge John McConnell Jr. barred federal transportation officials from carrying out that threat before the lawsuit is fully resolved.

“The Court finds that the States have demonstrated they will face irreparable and continuing harm if forced to agree to Defendants’ unlawful and unconstitutional immigration conditions imposed in order to receive federal transportation grant funds,” wrote McConnell, chief judge for the federal district of Rhode island. “The States face losing billions of dollars in federal funding, are being put in a position of relinquishing their sovereign right to decide how to use their own police officers, are at risk of losing the trust built between local law enforcement and immigrant communities, and will have to scale back, reconsider, or cancel ongoing transportation projects.”

Massachusetts Attorney General Andrea Campbell, in a statement posted on Bluesky, welcomed the ruling.

“The court granted a temporary order halting the Trump administration’s attempt to hold critical funding for states if they don’t comply with their cruel immigration policies,” Campbell said. This would have put critical funding for transportation in MA at risk. It’s not just wrong — it’s illegal.”

In a statement on X, Secretary of Transportation Sean Duffy said the ruling wasn’t surprising: “I directed states who want federal DOT money to comply with federal immigration laws. But, no surprise, an Obama-appointed judge has ruled that states can openly defy our federal immigration laws. This is judicial activism pure and simple.”

On April 24, states received letters from the Department of Transportation stating that they must cooperate on immigration efforts or risk losing the congressionally appropriated funds. No funding was immediately withheld.

Attorneys general from California, Colorado, Connecticut, Delaware, Hawaii, Illinois, Maine, Maryland, Massachusetts, Michigan, Minnesota, Nevada, New Jersey, New Mexico, New York, Oregon, Rhode Island, Washington, Wisconsin and Vermont filed the lawsuit in May.