A federal judge in northern California ruled that the U.S. Defense Department's sanctioning of AI firm Anthropic as a security risk was unlawful. File photo by Adam Vaugham/EPA

Aug. 28 (UPI) -- A federal judge in northern California ruled that the U.S. Defense Department's sanctioning of AI firm Anthropic as a security risk was unlawful.

In her decision Thursday, U.S. District Judge Rita Lin agreed with Anthropic's case that Defense Secretary Pete Hegseth had exceeded his authority by ordering contractors supplying the U.S. military not to use, or do business with, Anthropic.

Lin said the Pentagon had acted out of retaliation and in violation of Anthropic's First Amendment free speech rights.

The ban in February came after Anthorpic said it would not permit the use of its AI models by the U.S. military for purposes such as domestic surveillance and autonomous weapons systems, saying surveillance of Americans violated their rights and that its technology was not safe to use in systems capable of killing people without human input.