The Trump administration cannot use US foreign policy interests to justify its detention of Columbia University student and pro-Palestinian activist Mahmoud Khalil, a judge has ruled, but stopped short of ordering Khalil’s immediate release, Reuters reports.

US District Judge Michael Farbiarz in Newark, New Jersey, said his ruling would not take effect until Friday at 9:30am EDT (6:30pm PKT) to give the administration the chance to appeal.

Farbiarz wrote that the administration was violating Khalil’s right to free speech by detaining and trying to deport him under a little-used provision of US immigration law granting the US secretary of state the power to seek the deportation of any non-citizen whose presence in the country is deemed adverse to US foreign policy interests.

The judge also barred the administration from deporting Khalil on the grounds that his presence was allegedly adverse to US foreign policy.

“This is the news weve been waiting over three months for,” Khalil’s wife, Dr. Noor Abdalla, said. “Mahmoud must be released immediately and safely returned home to New York to be with me and our newborn baby, Deen.”