US District Judge Richard Stearns in Boston acted at the request of six refugees and two advocacy groups who argued the US Department of Homeland Security's policy was an unlawful departure from decades of practice.
The plaintiffs alleged the policy exposed over 100,000 lawfully admitted refugees whose adjustments of immigration status applications are pending before the US Citizenship and Immigration Services to potential detention.
Steven Bressler, a lawyer for the plaintiffs at the liberal legal group Democracy Forward, said in a statement the "ruling affirms that the government cannot manipulate the law to justify the mass arrest and detention of people."
DHS did not immediately respond to a request for comment.
The policy was adopted as part of Operation PARRIS, a program announced in January that DHS billed as "a sweeping initiative" to re-examine thousands of refugee cases.
DHS at the time said the initial focus would be the roughly 5600 refugees who had yet to be given green cards in Minnesota, but the plaintiffs said the agency left open the potential for it to expand to refugees in other states.
US Immigration and Customs Enforcement, which is part of DHS, in memoranda issued in December and February reinterpreted immigration law to mandate the detention of any refugee who fails to obtain lawful permanent resident status, or green cards, after one year in the United States.
The administration did so by reinterpreting a law that required lawfully admitted refugees to return to the "custody" of DHS for inspection and examination if they had yet to obtain green cards after a year.
Six refugees, along with the Jewish Family Service of Western Massachusetts and the International Institute of New England, sued on February 27.
They argued the policy was unlawful and a misinterpretation of the law. They noted that since the passage of the Refugee Act of 1980, the government had interpreted "custody" to mean only that refugees potentially report for an interview.
Stearns, who was appointed by Democratic President Bill Clinton, agreed, saying, "the term 'custody' has not historically been treated as synonymous with the term 'detention.'"