A federal judge has ordered the release of an Ecuadorean man who was arrested and held for deportation after delivering pizza to an army base in New York City, court documents show.
Federal Judge Paul Crotty, who presides over the Southern District of New York, ordered the immediate release of Pablo Villavicencio on Tuesday, saying that the release was necessary because his imminent removal from the U.S. was no longer reasonably foreseeable, according to the order.
Villavicencio was detained on June 1 after a confrontation happened between him and officials at the Fort Hamilton Military Base in Brooklyn, Brooklyn councilman Justin Brannan told ABC News after the arrest.
(MORE: Man delivers pizza to a military base and was turned in to immigration officials)On June 9, federal Judge Alison Nathan, also of the Southern District of New York, issued an emergency stay of deportation for Villavicencio and ordered immigration officials to not remove him from the New York City area while he remained in their custody. The stay was in effect until Friday.
Villavicencio was being held at a detention center in New Jersey since his arrest.
In Tuesday's order, Crotty said Villavicencio can remain in the U.S. while he exhausts his right to attempt to gain legal status. Although he had agreed at an immigration proceeding in March 2010 to leave the U.S. by July 15 of that year, he "continued to reside in this country," Crotty wrote.
Villavicencio, who is from Ecuador, applied to stay in the country after marrying a U.S. citizen, The Associated Press reported. The couple has two young daughters together.
"Although he stayed in the United States unlawfully and is currently subject to final order of removal, he has otherwise been a model citizen," the court document reads. "He now has two children, both of whom are United States citizens. He has no criminal history. He has paid his taxes. And he has worked diligently to provide for his family."
The day Villavicencio was arrested wasn't the first time he had delivered pizza to the base, Brannan said.
"In the past, he had entered the base with his New York City ID," Brannan said.
After arriving, Villavicencio was directed to the base's Visitor Control Center to obtain a daily pass and signed a waiver permitting a background check, according to a statement the base released after his arrest. Officials were then notified that an active ICE warrant was on his file, and he was subsequently turned over to ICE authorities, the statement read.
The Legal Aid Society, which has been representing Villavicencio, said in a statement that "the rule of law, humanity and morality prevailed tonight with the court's order releasing Pablo back to his family and community."
"This decision should serve as a rebuke against the Trump administration and its merciless crusade to tear families apart," Adriene Holder, attorney-in-charge of civil practice at The Legal Aid Society, said in a statement to ABC News.
The order is also "an affirmation that the courts can still serve as a check on the executive when it breaks with our laws and principles," Holder said.
"The Villavicencio family has finally received a crucial measure of relief from their 53-day nightmare and we will continue to fight alongside them to protect their right to remain in the community they call home," Holder said.
(MORE: Pizza delivery man detained by ICE wins stay of deportation)The Legal Aid Society provides legal assistance to "those who suffer in silence, face oppression and struggle to access justice because of poverty," according to its website.
The organization plans on working with Villavicencio toward securing a valid status.
ABC News' Josiah Bates contributed to this report.