Immigration authorities deported Oumar Yaide to his native Chad soon after Thanksgiving, ending his decade-long battle to obtain asylum in the United States.

But a federal judge has ordered the Department of Homeland Security to bring the 31-year-old back — a rare move that shows the agency violated Yaide’s due process rights when it deported him, his attorneys said.

Still, it’s unclear when Homeland Security will fly him back to San Francisco, where he’s lived for about eight years. His attorneys are worried that Yaide, a gay Muslim man who has not lived in Chad for 10 years, is in danger in a country where gays and others are targeted.

U.S. District Judge Charles Breyer granted Yaide a temporary restraining order on Dec. 18 requiring the government to return him to the U.S. as he awaits a court decision that may determine whether officials will reopen his case.

“Yaide has a constitutional right to procedural due process,” Breyer wrote in his ruling. “He also enjoys a statutory right to file a motion to reopen his removal proceedings.”

But Sean McMahon, Yaide’s attorney, said the government has given no indication of when it will bring him home.

Chad criminalized homosexuality in late 2016. The country in north-central Africa is under a dictatorship and is fraught with political turmoil. Lesbian, gay, bisexual and transgender people are at risk of being tortured or killed by family members or the government if they’re outed.

“The president has been in power for 30 years, and there’s extreme and widespread human rights abuses across the board,” said McMahon, an attorney with Pangea Legal Services, a San Francisco nonprofit that represents immigrants in complex legal matters, such as asylum.

“Our top concern is getting him back as fast as possible. Any additional day he spends in Chad is very concerning to me.”

The Executive Office for Immigration Review, which oversees U.S. immigration court, said it does not comment on federal court decisions. It deferred questions about return procedures to Homeland Security, which oversees ICE.

ICE said it does not comment on pending litigation.

Steve Yale-Loehr, a professor of immigration law practice at Cornell Law School, said it’s rare for people who are deported to be able to return to the U.S.

“Procedures exist to bring people back, but foreign nationals rarely know about them, and the government is loath to allow it unless a federal judge orders it,” he said in an email. “Unfortunately, this administration is deporting more and more asylum seekers erroneously.”

Yale-Loehr said Breyer did not rule that Homeland Security necessarily violated the law by deporting Yaide while his motion to reopen was pending, but that he had jurisdiction to consider Yaide’s request for relief. Homeland Security had argued the judge did not have the authority to do so, according to the ruling.

Yaide, a restaurant worker known for his kindness and positivity, is popular in his community, according to McMahon and Yaide’s friends. He previously volunteered with the African Advocacy Network, a San Francisco nonprofit that provides immigration, legal and other services.

Yaide immigrated to the U.S. in 2009. He petitioned for asylum as a member of the Gorane ethnic group and said he was at risk of persecution in his home country because his family expressed anti-government views.

An immigration judge denied his petition for asylum in September 2014. The Board of Immigration Appeals and the Ninth U.S. Circuit Court of Appeals in San Francisco denied his appeals, most recently in December 2018.

ICE arrested Yaide in August after agents showed up at his apartment in the Mission District claiming to look for someone else, his attorney said. They took him to the Yuba County Jail in Marysville, where he was detained for about three months.

McMahon filed a motion to reopen Yaide’s case in October, requesting that the court allow him to present a new basis for asylum. Yaide had not come out as gay when he originally petitioned for asylum in 2009. Returning to Chad would put him in grave danger, his attorney argued.

But with the motion to reopen pending, authorities pulled Yaide out of Yuba Dec. 1, transferring him to the Sacramento airport without notifying McMahon, he said. Friends found out he was no longer in the jail and notified McMahon.

The next day, Pangea attorneys petitioned the court and requested a temporary restraining order in a last-minute effort to halt Yaide’s deportation.

They had no idea where Yaide was but hoped he was still in the U.S., McMahon said.

A judge granted the order, halting Yaide’s deportation until oral arguments could be made in a formal hearing before Breyer on Dec. 4.

But Yaide was already in Chad. He had been in Homeland Security custody — out of the country on an airplane — when attorneys petitioned on his behalf, McMahon said.

They moved forward with the hearing, and Breyer issued a decision Dec. 18 ordering Homeland Security to bring Yaide back.

“If Yaide is imprisoned or killed in Chad, the government will have denied him any chance to have his motion to reopen adjudicated,” he wrote.

ICE was originally required to return Yaide within two weeks, but the agency asked for more time. They must update the court by Wednesday.

McMahon said Yaide’s case is unique because he’s gotten overwhelming support from neighbors and friends who have become a second family to him during his time in San Francisco.

They took weekly road trips to visit Yaide in Yuba, made dozens of calls to his deportation officer to advocate for his release, and raised funds at a local bar to help with his legal defense. A GoFundMe for Yaide collected $11,600.

Tatiana Sanchez is a San Francisco Chronicle staff writer. Email: Tatiana.Sanchez@sfchronicle.com Twitter: @TatianaYSanchez