A federal judge on Saturday temporarily blocked the deportation of a New York pizza shop worker to his native Ecuador after he was arrested while making a delivery to a Brooklyn army base.

Attorneys for the Legal Aid Society obtained the temporary stay for Pablo Villavicencio after a hearing in Manhattan federal court.

The 35-year-old married father of two young girls was arrested on 1 June while making a delivery to the garrison in Fort Hamilton. A background check revealed there was a warrant for his arrest for immigration law violations.

Federal judge Alison Nathan granted the stay until 20 July. Villavicencio will remain in Immigration and Customs Enforcement (Ice) custody in New Jersey until his case goes to court.

New York governor Andrew Cuomo had asked federal homeland security officials to look into the case, saying recent detentions raise significant legal questions. In a letter to the Ice office in New York, the Democrat said Villavicencio’s “expedited removal serves no legitimate public safety purpose and the circumstances leading to his arrest and detention raise serious legal and policy concerns”.

Villavicencio’s wife, Sandra Chica, is an American citizen and their daughters, ages two and three, were born in the US. When he arrived at Fort Hamilton, guards requested identification and he produced a city identification card. A background check showed that Villavicencio had been ordered to leave the US in 2010, but stayed.

Redmond Haskins, a spokesman for the Legal Aid Society, a nonprofit organization that provides free services to clients who cannot afford them, said Villavicencio has no criminal record. Haskins said attorneys worked through the night preparing the emergency stay request that was argued in court on Saturday afternoon.

“Although we are disappointed that Pablo will remained detained, today’s stay is a victory for him and his family, and also for due process and the fair administration of justice,” said Gregory Copeland, the supervising attorney of Legal Aid’s Immigration Law Unit.

“This decision is also a reminder that the judiciary can still serve as a powerful check when other branches of government make hasty, cruel and reckless decisions.”

The attorneys said they will work with Villavicencio to help him secure valid immigration status.