A federal judge on Tuesday ordered the release of Pablo Villavicencio Calderon, the man who was detained and eventually turned over to US Immigration and Customs Enforcement when delivering pizza to a military base in New York City.

Pablo Villavicencio, also known as #PizzaGuy is released from a Hudson County jail following a ruling by a federal court judge granting him the right to obtain a waiver to kill his 2010 deportation order. https://t.co/WmW3vihVXl

Calderon was asked for his ID when he was delivering pizza to Fort Hamilton in Brooklyn on June 1, his wife said previously. Base security determined that Calderon had an outstanding warrant for his deportation, Crotty detailed in Tuesday's order, leading base security to detain Calderon until he could be turned over to ICE.

The plan was for ICE to hold him until he could be deported to Ecuador. Before that could happen, however, Calderon filed the action in federal court, seeking to stop his removal. Over the next weekend, US District Judge Alison Nathan ordered that Calderon could not be deported or moved out of the New York City area while his request was pending. The case was then transferred to Crotty, who heard arguments over his request earlier this month.

In Crotty's order on Tuesday, he ruled that he had the authority to consider Calderon's case despite a federal law that limits most court review of removal orders. This is, he ruled, because Calderon was coming to the court to raise "the limited question" of whether he has the right to complete the process of seeking a "provisional waiver of grounds of inadmissability" — in other words, an administrative ruling that would allow him to stay in the country.

Crotty found that Calderon had this right, and to deport him before he was able to do so would violate both the Administrative Procedure Act and his due process rights. As such, Crotty ordered that Calderon cannot be deported unless he is denied in his request for that relief.