In a Manhattan courtroom, lawyers for a detained Palestinian student activist argued Donald Trump’s administration was attempting to restrict access to their client, as hundreds gathered to protest on his behalf.

Mahmoud Khalil, a US permanent resident and Columbia University graduate, was detained over the weekend and faces deportation for his participation in 2024 protests at the campus over the war in Gaza.

Mr Khalil’s legal team on Wednesday pushed to bring him back from a detention centre in Louisiana where he was sent after his arrest in New York.

The judge did not issue a ruling at the hearing, but directed prosecutors to prove why the case should take place elsewhere.

Mr Khalil is a green card holder and is married to an American citizen, but his attorney said that when he was arrested, agents told him the green card was being revoked. Earlier this week, Judge Jesse Furman blocked President Donald Trump’s attempt to deport him.

The Department of Homeland Security (DHS) has said the arrest was part of its effort to fulfil Trump’s executive order that prohibits antisemitism. It accused Mr Khalil of leading “activities aligned to Hamas” – the Islamist group based in Gaza that the US has designated a terrorist organisation – but provided no details.

The BBC has asked the DHS for further information on the allegations.

Absent from Wednesday’s hearing was Mr Khalil, who is being held in Jena, Louisiana, after he was initially sent to a New Jersey facility Sunday, his lawyers said. Government lawyers argued in court that the deportation case should play out in Louisiana or New Jersey.

The judge will not issue a ruling on the jurisdiction or where Mr Khalil will be held until both sides file motions this week, including prosecutors’ reasoning for moving the case away. They agreed the case should move “as expeditiously as possible”, as Mr Khalil’s attorney requested.

His lawyers said they had not been able to speak officially with their client by phone since his detainment and at times, did not know where he was. Judge Furman directed prosecutors on Wednesday to ensure phone access.

The judge also ruled that documents in Mr Khalil’s case be made public, citing the “significant public interest” in the case.

Trump has said Mr Khalil’s arrest is the first of “many to come”, pledging to crack down on college protesters who he accuses of sympathising with Hamas.

His detainment has sparked nationwide protests. Outside of court, demonstrators chanted and waved flags in support of Mr Khalil and Palestinians. Among the protesters was actress Susan Sarandon, who told the BBC that Trump officials were trying to “disappear” Mr Khalil.

Mr Khalil’s lawyer Ramzi Kassem said outside court that his case should “outrage anybody in the United States who thinks speech should be free”.

US civil rights advocates, lawmakers and some Jewish groups have said that deporting Mr Khalil would violate American due process rights and is an attack on free speech.

The Immigration and Nationality Act allows the State Department to deport noncitizens who are “adversarial to the foreign policy and national security interests” of the US. Secretary of State Marco Rubio said Wednesday that the US could deport visa and green card holders for “virtually any reason”.

Still, legal experts said the case against Mr Khalil is unprecedented.

“Targeting individual protesters just for protesting … is highly unusual and something that we haven’t seen before, even under the first Trump administration,” said Jacob Hamburger, a visiting assistant professor at Cornell Law School.

Mr Khalil’s wife, who has not been named, detailed her husband’s arrest in a statement released by their lawyers on Tuesday. She said that the pair were confronted by immigration agents on Saturday when they returned to their apartment from a dinner.

The officials did not provide a warrant or a reason for arrest, she said, and ended a call to the couple’s lawyers. They then handcuffed Mr Khalil and forced him into an unmarked car.

“Watching this play out in front of me was traumatizing: It felt like a scene from a movie I never signed up to watch,” she said.

Mr Khalil – who was born in Syria to Palestinian refugees – has been in immigration detention since his arrest, first in New Jersey and then Louisiana.

“Instead of putting together our nursery and washing baby clothes in anticipation of our first child, I am left sitting in our apartment, wondering when Mahmoud will get a chance to call me from a detention center,” Mr Khalil’s wife, who is eight months pregnant, said.

Mr Khalil has long maintained that he simply acted as a spokesperson and mediator for the Columbia student protesters.

Critics have accused him of leading Columbia University Apartheid Divest (Cuad) – a student group that demanded the school divest from Israel and called for a ceasefire in Gaza – which the Palestinian activist has denied.

Columbia was just one college campus that played host to mass student protests after the war erupted in Gaza. Some are now concerned that the Trump administration is attempting to silence potential detractors by targeting protesters who are not US citizens.

But critics of Mr Khalil and some students protesting over the war in Gaza have in recent weeks reportedly advocated for the deportation of Mr Khalil and other protesters.

Trump appeared to respond to these calls when he posted on social media on Monday about Mr Khalil’s detainment.

“We know there are more students at Columbia and other Universities across the Country who have engaged in pro-terrorist, anti-Semitic, anti-American activity, and the Trump Administration will not tolerate it… We will find, apprehend, and deport these terrorist sympathizers from our country – never to return again,” the president wrote.