A prominent immigration activist was released Monday night, after federal immigration officials had detained him earlier this month.

Ragbir said his release was bittersweet. "This is not a moment for us to celebrate. Yes, I am happy to be out, but, as you know, there's many people who are not, and we have to change this."

Earlier Monday, a federal judge ordered the release of Ravi Ragbir.

Judge Katherine Forrest, who is a President Obama appointee, called Ragbir's detention unnecessarily cruel. In her ruling, she delivered what was essentially a rebuke to the Trump administration's detention and deportation policies.

She said Ragbir and others in similar situations have the right to say goodbye to their families when they are not threats to the community.

"It ought not to be — and it has never before been — that those who have lived without incident in this country for years are subjected to treatment we associate with regimes we revile as unjust, regimes where those who have long lived in a country may be taken without notice from streets, home, and work. And sent away," Forrest wrote in her ruling.

Ragbir's lawyers argued he was targeted by U.S. Immigration and Customs Enforcement (ICE) agents after Ragbir and his organization protested outside his office.

Ragbir is one of the city's leading advocates for undocumented immigrants, but he also has been fighting his own deportation after a wire fraud conviction led to the loss of his green card.

When he reported for his check-in with ICE on Jan. 11 in Manhattan, he was handcuffed and held for removal to his native Trinidad, triggering a wild protest outside that led to the arrests of two city councilmen.

In a statement, ICE took pains to call Ragbir an "aggravated felon" and said it was "concerned with the tone of the district court's decision." The agency also said it is exploring an appeal.

Ragbir's release does not block his deportation, but it allows him to remain free while fighting to overturn the conviction that created the deportation threat.

Ragbir's wife plans to attend the State of the Union address on Tuesday as a guest of New York Rep. Nydia Velazquez; Ragbir is expected join her on the trip to Washington.