A New Jersey federal judge ruled Wednesday that the Trump administration's effort to deport pro-Palestinian activist Mahmoud Khalil on foreign policy grounds is likely unconstitutional, but stopped short of releasing him from detainment. In a lengthy order, U.S. District Judge Michael Farbiarz said Khalil was "likely to succeed" in his claim that the administration's determination of him as a threat to U.S. foreign policy is "unconstitutionally vague." Farbiarz said therarely used provision in immigration law the government cited for Khalil's detentionwas "unconstitutional as applied" to Khalil, and added that Secretary of State Marco Rubio did not "affirmatively determine" that Khalil's conduct had any impact on U.S. relations with another country. Farbiarz said that deporting Khalil under the provision would be "unprecedented." "The district court held what we already knew: Secretary Rubio's weaponization of immigration law to punish Mahmoud and others like him is likely unconstitutional.," Khalil's legal team said in a statement to NBC News. They added that his continued detention is an "affront to justice" and vowed to continue fighting for his freedom. The Department of Justice and the State Department didn't immediately respond to NBC News' request for comment Wednesday night. Farbiarz's ruling marked the first time a federal judge has weighed in on the constitutionality of the Trump administration's use of the immigration provision. He ordered Khalil's legal team to submit additional information while he considers their request to release Khalil and block the administration from invoking the law against other noncitizens who have spoken out in support of Gaza or were critical of Israel while the case proceeds. Still, Farbiarz said, Khalil's attorneys have not made a "substantial argument" against the government's allegations that Khalil withheld information from his permanent residency application. Farbiarz said his attorneys are permitted to address the issue in subsequent filings. Khalil, who is a permanent U.S. resident, was arrested at his Columbia University apartment in March as part of President Donald Trump's crackdown on foreign students who his administration alleges are a threat to U.S. foreign policy. After his arrest in New York, Khalil was transported briefly to a facility in New Jersey and then transferred to an ICE facility in Jena, Louisiana, where he is currently held. Assistant Homeland Security Secretary Tricia McLaughlin said in a statement Wednesday night: "It is a privilege to be granted a visa to live and study in the United States of America. When you advocate for violence and terrorism that privilege should be revoked, and you should no longer be in this country." Khalil's attorneys have submitted evidence rebuking allegations of antisemitism, and denied he ever provided support to Hamas or any other other terrorist organization. Multiple federal judges in recent weeks have ordered the government to release other pro-Palestinian activists, includingMohsen Mahdawi,Rumeysa OzturkandBadar Khan Suri, from immigration detention while they fight the administration's efforts to deport them.