A U.S. judge ordered on Friday that Columbia University graduate Mahmoud Khalil be released from the immigration detention center where he has been held since early March, in a major victory for rights groups that challenged what they called the Trump administration’s unlawful targeting of a pro-Palestinian activist.

U.S. District Judge Michael Farbiarz announced the decision from the bench in New Jersey, responding to a request from Khalil’s lawyers to free him on bail or, at the very least, move him from a Louisiana jail to New Jersey so he can be closer to his wife and newborn son.

Ruling from the bench in New Jersey, U.S. District Judge Michael Farbiarz said it would be “highly, highly unusual” for the government to continue to detain a legal U.S. resident who was unlikely to flee and hadn’t been accused of any violence. In reaching his decision, he said Khalil is likely not a flight risk and “is not a danger to the community. Period, full stop.”

He ordered Khalil released from a detention center in rural Louisiana later Friday. The government had “clearly not met” the standards for detention, he said later in the hour-long hearing, which took place by phone.

Khalil, a visible figure and a lead negotiator for protesters during last spring’s Gaza solidarity encampment on the Columbia campus, was arrested by Immigration and Customs Enforcement agents at his university-owned apartment in March.

In January, the Trump administration promised to deport pro-Palestinian protesters in America on student visas, a dramatic step with significant implications for First Amendment issues and immigration policy. Khalil — a Syrian-born permanent resident of the U.S. — was the first case in which the threat was carried out.

Within a day, he was flown across the country and taken to an immigration detention center in Jena, thousands of miles from his attorneys and wife, a U.S. citizen. Khalil, 30, became a U.S. permanent resident last year, and his wife and newborn son are U.S. citizens. Khalil’s request to attend the birth of his first child in April was denied by federal immigration authorities.

U.S. President Donald Trump praised the arrest over his leading role in Columbia University’s Gaza solidarity encampment protest movement, vowing it would be the first of many similar detentions to come. Khalil’s lawyers have challenged the legality of his detention, saying the Trump administration is trying to crack down on free speech protected by the U.S. Constitution.

The arrest sparked mass protests both on campus and across New York City, in an effort to release the Palestinian activist, with the hashtag “Free Mahmoud Khalil” trending on social media.

The move spurred many Jewish activists in particular, with more than 120 Jewish alumni of Columbia having signed a public letter denouncing what they termed the “illegal detention” of Khalil.

U.S. District Judge Michael Farbiarz of Newark, New Jersey, ruled on June 11 that the government was violating Khalil’s free speech rights by detaining him under a little-used law granting the U.S. secretary of state power to seek deportation of non-citizens whose presence in the country was deemed adverse to U.S. foreign policy interests.

But the judge declined on June 13 to order Khalil’s release from a detention center in Jena, Louisiana, after President Donald Trump’s administration said Khalil was being held on a separate charge that he withheld information from his application for lawful permanent residency.

Khalil’s lawyers denied that allegation and said people are rarely detained on such charges. On June 16, they urged Farbiarz to grant a separate request from their client to be released on bail or transferred to immigration detention in New Jersey, closer to his family in New York.

Trump administration lawyers wrote in a June 17 filing that Khalil’s request for release should be addressed to the judge overseeing his immigration case, an administrative process over whether he can be deported, rather than to Farbiarz, who is considering whether Khalil’s March 8 arrest and subsequent detention were constitutional.