A U.S. Immigration and Customs officer works a new border crossing during the opening day of the Cross Border Xpress pedestrian bridge in Otay Mesa, California, Dec. 9, 2015. Reuters

After a long legal battle in Miami federal court, a gay undocumented immigrant from Mexico has won the right to stay in the U.S., even though he was deported once before. Although U.S. immigration wanted to toss José Crespo-Cagnant back out of the country for a second time, his lawyer successfully argued that he would be in danger if that happened.

Crespo-Cagnant’s attorney made the case that, since he is gay, he faces potential danger of persecution should he return to Mexico, a prospect that was not considered when he was deported the first time. He now faces the welcome path to legal status instead of repeated deportation.

“What this means is that he is free out of any kind of criminal charges,” said Rebeca Sánchez-Roig, the 36-year-old Crespo-Cagnant’s attorney, the Miami Herald reported. “That hopefully the Border [Patrol] will vacate the expedited removal order that the judge ruled was unconstitutional and José will get an opportunity then to adjust his status.”

Asylum-Seekers in United States by Country of Origin in 2015 | FindTheData

Crespo-Cagnant’s story dates back to 2002, but this specific legal case started in January 2012 when he was caught crossing into the United States and placed on an expedited deportation order. When asked if he was seeking asylum, he indicated that he feared persecution, which began the yearslong legal proceeding that just recently came to a close.

The U.S. is one of the top countries in the world for the resettlement of refugees and asylum seekers. In 2013, the last year for which data is available on the number of asylum-seekers in the U.S., there were 25,199 people admitted into the country, according to MigrationPolicy.org.

During that year, the biggest population of asylum-seekers came from China followed by Egypt. Only 155 Mexicans were admitted as asylum-seekers in 2013, according to data provided by the Department of Homeland Security.