A Manhattan federal judge ordered the immediate release of Ravi Ragbir, a prominent immigrant activist detained by U.S. Immigration and Customs Enforcement (ICE) earlier this month.

While reporting to ICE for a routine check-in at 26 Federal Plaza on Jan. 11, Ravi Ragbir, executive director of New Sanctuary Coalition of NYC—an interfaith organization that helps undocumented immigrants fight detention and deportation–was detained and taken to a facility in Miami. A court then ordered he be sent to a facility in Goshen, a town in Orange County, New York.

U.S. District Judge Katherine Forrest argued ICE infringed upon Ragbir’s due process rights by his “abrupt and by all counts unnecessary detention,” according to New Sanctuary Coalition of NYC.

“There is, and ought to be in this great country, the freedom to say goodbye,” Forrest wrote in the opinion and order dated Monday provided to Observer. “That is, the freedom to hug one’s spouse and children, the freedom to organize the myriad of human affairs that collect over time.”

The New York University School of Law’s Immigrant Rights Clinic represents Ragbir in his lawsuit. Brittany Castle and Jeremy Cutting presented the case on behalf of Ragbir with clinic supervisors Alina Das and Jessica Rofé.

Ragbir, who got his green card in 1994, was detained by ICE for nearly two years when he was placed in removal proceedings in 2006 due to an old wire fraud conviction, according to New Sanctuary Coalition of NYC. He was released in 2008 when ICE concluded he was not a flight risk or a danger to the community.

In March, he staved off deportation.

“Now the fight is to make sure Ravi can remain here with his family and continue his work to support immigrant rights in the United States,” Amy Gottlieb, Ragbir’s wife, said in a statement.

Rofé told Observer in a telephone interview the detention was “unlawful at its start” and that the legal team spoke to Ragbir.

“I think he was in a little bit of disbelief quite frankly,” she said. “When… we had no idea what to expect and so it was surprise to be issued a decision on the spot, and so we hadn’t had conversations about what would happen.”

She noted they are “scrambling” to get him out of detention and that everyone is “thrilled.”

His next hearing is on Feb. 9, and while the judge denied ICE’s request for a stay of her order, there could be future litigation, Rofé said.

Khaalid Walls, an ICE spokesman, told Observer it is preparing Ragbir for release from custody and blasted the elected officials as well as Forrest.

“The agency is deeply disturbed by the harmful personal attacks some Congress-members have leveled against career law enforcement personnel, whose sworn duty is enforcing laws enacted by Congress itself,” Walls said in a statement. “The agency is similarly concerned with the tone of the district court’s decision, which equates the difficult work ICE professionals do every day to enforce our immigration laws with ‘treatment we associate with regimes we revile as unjust,’ and is actively exploring its appellate options.”

Rep. Joseph Crowley (D-Queens/Bronx) and Rep. Nydia Velázquez (D-Brooklyn/Queens) sent a letter to Kirstjen Nielsen, secretary of the U.S. Department of Homeland Security, on Jan. 26 requesting a meeting.

Velázquez, who is bringing Gottlieb to President Donald Trump’s State of the Union Address on Tuesday, and Crowley, both took to Twitter to praise the judge’s decision.

Excellent news! A federal judge has ordered the release of Ravi Ragbir. This is a major victory for Ravi’s family, our community, and the movement. We must continue to fight his deportation and that of others. #IStandWithRavi, proudly. — Rep. Joe Crowley (@repjoecrowley) January 29, 2018

1/2 I’m heartened the Judge made the correct and humane decision today in ordering ICE to release Ravi from detainment. I know much still remains ahead in Ravi’s ongoing fight to stay in this country, but this is an important milestone. — Rep. Nydia Velazquez (@NydiaVelazquez) January 29, 2018

Former City Council Speaker Melissa Mark-Viverito, one of many lawmakers who have been advocating for Ragbir since March, also lauded the move.

“Powerful sentiment that eloquently captures the reality we are living,” Mark-Viverito tweeted, in response to the judge’s comments.

At a rally for Ragbir, the NYPD arrested 18 people, including Brooklyn Councilman Jumaane Williams and Upper Manhattan Councilman Ydanis Rodriguez. Cops pushed Williams onto the front of a car and placed Rodriguez in a headlock, and City Council Speaker Corey Johnson was shoved.

Mayor Bill de Blasio said ICE engaged in a “provocative action.” ICE insisted only Federal Protective Service and the NYPD were present.

In a joint statement, Williams and Rodriguez described the decision as “extraordinarily significant” but vowed to use all the tools at their disposal to help Ragbir.

“As the Trump administration seems to be deliberately and aggressively targeting its political opponents, they are sure to continue to push for the deportation of a bolder leader like Ravi Ragbir,” the councilmen said.

The New York Immigration Coalition blasted ICE.

“This is a naked attempt to intimidate us into silence, but we will only get louder,” Steve Choi, the group’s executive director, said in a statement.

This story has been updated to include a statement from an ICE spokesman.