Mr Ragbir, 43, was arrested on January 12 during a routine check-in with Immigration and Customs Enforcement (ICE) and ordered immediate deportation, irking local community in New York.
In a seven-page decision, Manhattan Federal Court Judge Katherine Forrest wrote that Immigration and Customs Enforcement agents had violated Ragbir's rights to due process, New York Daily News reported.
"The court finds that when this country allowed (Ragbir) to become a part of our community fabric, allowed him to build a life with and among us and to enjoy the liberties and freedom that come with that, it committed itself to allowance of an orderly departure when the time came, and it committed itself to avoidance of unnecessary cruelty when the time came," Forrest wrote.
"By denying (Ragbir) these rights, the government has acted wrongly," Forrest added.
She wrote that Mr Ragbir was "entitled to the freedom to say goodbye" - indicating the activist still faces eventual deportation.
As Forrest announced her decision, some in the courtroom erupted in applause.
He was placed into removal proceedings in 2006 and spent 22 months in immigration detention before being released in February 2008.
During immigration detention and since his release, Mr Ragbir has worked tirelessly to end the use of immigration detention, stop deportations, and secure relief for countless individuals.
Previously, ICE officials had granted Mr Ragbir prosecutorial discretion, including a stay of removal that was in effect until next week.
Known as a fixture in the immigrant rights movement, Mr Ragbir was awarded the 2017 Immigrant Excellence Award by the New York State Association of Black and Puerto Rican Legislators, given to those who show "deep commitment to the enhancement of their community."