A Twin Cities immigration judge has ordered the release of a detainee who faced deportation after a highly publicized encounter with a Metro Transit officer in May.

Judge Ryan Wood set a $5,000 bond and postponed the case of Ariel Vences-Lopez, who is seeking a special visa for victims of crime who cooperate with law enforcement. Vences-Lopez is a Mexican citizen and construction worker who had crossed the border illegally in 2012.

His case drew international attention after a fellow light-rail passenger posted a video of an officer asking him if he was in the country illegally during a fare check. The encounter garnered about 1.5 million views online and led Metro Transit to weigh a new policy that would bar officers from inquiring about passengers’ immigration status in most cases.

Vences-Lopez was tased and arrested on suspicion of fare evasion, obstructing an officer and giving a false name, but the charges have been dropped. U.S. Immigration and Customs Enforcement took Vences-Lopez into custody soon after his arrest.

Danielle Robinson Briand, Vences-Lopez’s attorney, hailed his release, as did a couple dozen supporters who packed the Fort Snelling courtroom Thursday. “I am very pleased with how measured and reasoned the decision was,” she said. “[Wood] was a great judge today.”

ICE attorneys argued that the judge should not grant Vences-Lopez bond or postpone his case until the government reviews his application for what is known as a U visa. They stressed that candidates for this type of visa can wait outside the United States and return if their applications are approved.

Vences-Lopez says he was assaulted and robbed in the days before his encounter with the Metro Transit officer but never reported the crime to police out of fear that it would bring him to the attention of immigration authorities, said Robinson Briand, who took on his case pro bono after learning of it from media reports. A U visa would allow him to stay in the country and open up a path to citizenship.

The number of U visa applications has risen rapidly in recent years, and a sizable backlog has formed. The government grants 10,000 visas for victims each year.

When Robinson Briand approached Vences-Lopez in immigration detention at Sherburne County jail, he had agreed to be deported to Mexico. She persuaded Wood to reopen the case on the grounds that her client did not fully understand what he was agreeing to. She learned of the robbery at that point, she said, and says it was the reason Vences-Lopez did not pay his light-rail fare on the day of his arrest.

Separately, attorney Bruce Nestor, who is also representing Vences-Lopez for free, is weighing a civil rights complaint related to the incident. His office is exploring whether the arrest was discriminatory and involved excessive force.

Meanwhile, immigrant advocates have rallied around Vences-Lopez. By Thursday morning, they had raised more than $4,000 for his bond, and Robinson Briand said he will likely be released by Friday.

Macalester Plymouth United Church in St. Paul has offered to put up Vences-Lopez temporarily when he is released, and he will be able to apply for a permit to work legally while his case is pending. Community members who have never met the 23-year-old wrote the immigration court in his support.

In the courtroom Thursday, Wood said that Vences-Lopez’s U visa application appears likely to be approved by U.S. Citizenship and Immigration Services.

“This does not appear to be a case where the respondent is not likely to be granted a U visa and is simply using the application as a dilatory tactic,” he said.

But he said a $2,200 bond Robinson Briand was seeking was too low. He noted money for the bond was raised in small donations, meaning the detainee himself did not have “a lot of skin in the game.”

Robinson Briand said she is hopeful that her client will ultimately be allowed to remain in the United States legally.

“This is a slam dunk U visa case in my experience,” she said, “and I do a lot of them.”