A federal judge ruled the Pentagon’s decision to label AI company Anthropic a ‘supply chain risk’ violated the law and ordered the designation be removed Thursday evening.

Judge Rita Lin wrote that while the military should have wide latitude to decide which companies to work with, its actions against Anthropic “constituted unlawful retaliation in violation of the First Amendment” and that the company “was denied the pre-deprivation process required under the Fifth Amendment.”

The Department of Defense’s quarrel with Anthropic began earlier this year after the company refused to remove internal safety guardrails that would prevent the military from using its Claude AI model in autonomous weapons and mass surveillance. Anthropic argued its models were not reliable enough to be used for such purposes.

Defense Secretary Pete Hegseth said the government could not allow the American military to be constrained or told how to use its tools by a private company and in February took the unprecedented step of labeling Anthropic a supply chain risk. The designation, which meant no part of the Pentagon including contractors could work with Anthropic’s products, had previously been used only for companies seen as connected to foreign adversaries. Anthropic sued in March.