A federal judge has ordered the Department of Homeland Security to return a gay asylum-seeker who was deported to Chad, ruling that the government had not properly considered his asylum claim based on his status as a gay man before deporting him.

Oumar Yaide arrived in the U.S. in 2009 and requested political asylum because he was a member of “a disfavored group,” a Chadian ethnic group called the Gorane. His asylum application was denied in 2014, and in December 2018 a judge denied his final appeal.

In October, however, two months after officers from Immigration and Customs Enforcement, or ICE, removed him from his San Francisco home and sent him to California’s Yuba County Jail, Yaide filed a motion to reopen his asylum case. This request for relief was based upon new information: Chad criminalized homosexuality in 2016 — years after Yaide arrived in the U.S. — and Yaide came out as gay in 2019. This combination, according to court documents, led Yaide to fear “torture and death” if he returned home to the central African nation.

But in early December, while Yaide’s new case was waiting to be seen by an immigration judge, ICE agents removed him from the Yuba County Jail, processed his deportation and sent him to the Sacramento airport, where he and two ICE agents boarded a flight to Chad. Yaide was in handcuffs until a layover in Addis Ababa, Ethiopia. His lawyers said they had no idea where he was during the trip.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

While Yaide was making the long journey back to Chad, his attorneys filed an instant habeas petition and temporary restraining order requesting that the government return him to the U.S. Last month, U.S. District Judge Charles R. Breyer granted the request and ordered Homeland Security to return Yaide to the U.S., ruling the “deportation violates his procedural due process right to pursue his motion to reopen.”

“Obviously, imprisonment or death would foreclose Yaide’s ability to pursue his motion to reopen,” Breyer wrote in his order, referring to the possible punishment Yaide could face as a gay man in Chad.

Returning Yaide to the U.S., however, is not without complications. He has an expired Chadian passport, and Homeland Security says it has no jurisdiction to retrieve him from Chad without a valid passport. It is unknown whether Chad’s government will issue him a new one.

Breyer’s ruling directed the U.S. government to work with Yaide’s lawyers to “formulate a mutually agreeable plan to return Yaide to the United States as soon as practically possible.”

Edwin Carmona-Cruz, co-director of Pangea Legal Services, the group representing Yaide, told NBC News on Wednesday that his organization is now “working with federal elected officials to assist in this process.”

Tanya J. Roman, an ICE spokesperson, said the agency is “unable to comment due to pending litigation.”

Chad is one of 68 U.N. member states where consensual same-sex activity is illegal, according to ILGA World, an international LGBTQ advocacy organization. In the United States, asylum-seekers have been successful with claims of potential persecution because of membership in a “social group,” namely the LGBTQ community.

In 1994, Attorney General Janet Reno ordered that the ruling in the case of a Cuban gay asylum-seeker, Fidel Armando Toboso-Alfonso, should be the guidance for future cases, thus cementing an earlier decision finding that Taboso-Alfonso was eligible for asylum because of his membership in the LGBTQ “social group” and the threat of political violence he would face if he were forced to return to his home country of Cuba.

Aaron C. Morris, executive director of Immigration Equality, a nonprofit LGBTQ immigrant advocacy group, said Yaide’s case will have no clear impact on other LGBTQ asylum-seekers. However, he noted that “it’s pretty common” for LGBTQ asylum-seekers, like Yaide, to first seek asylum with a claim other than their sexual orientation or gender identity.

“A lot of our clients, often before they meet Immigration Equality, for various reasons, put forward meritorious claims that aren't successful, whether that is a religion-based claim or political opinion claim like in this case,” Morris said. “That could be a young person whose parents are paying for a lawyer and involved with their case, a person who is from anti-queer country but living with relatives or living within that community — there are a lot of reasons that are really compelling why someone might only bring a claim based on sexual orientation later in the life of a case.”

Follow NBC Out on Twitter, Facebook & Instagram