The judge is the first to establish that the law, the so-called Alien Enemies Act, cannot be used to deport individuals who the Trump administration claims are gang members.
In the decision, the judge writes that he does not oppose the government's right to deport criminals, but that Trump's invocation of the law contradicts the legislative intent and is therefore "illegal".
Trump declared in March that the Venezuelan gang Tren de Aragua had invaded the USA and would therefore be covered by the law.
The US Supreme Court temporarily stopped the deportation of Venezuelans who had been detained in Texas about two weeks ago, after the civil rights organization ACLU appealed.
The Supreme Court decided earlier in April that the deportations could continue if those affected had a "reasonable time" to seek a judicial review.
The notable deportations are to El Salvador, where the individuals are placed in a high-security prison.
The Alien Enemies Act has previously only been invoked three times in US history. Most recently, it was during World War II, when the purpose was to intern Japanese-Americans.