Foreign nationals are arrested during a targeted enforcement operation.

A federal magistrate judge has ordered officials to defend the arrest of an undocumented immigrant who has protection from deportation during a raid last week, BuzzFeed News has learned.

Daniel Ramirez was detained by US Immigration and Customs Enforcement (ICE) in Seattle on Feb. 10 and threatened with deportation, despite being a recipient of the Deferred Action for Childhood Arrivals program, also known as DACA, a lawsuit filed on Monday alleges.

About 750,000 young immigrants — referred to as DREAMers because of the protections sought for them by the DREAM Act — were shielded from deportation and received work permits under then-President Barack Obama’s 2012 executive actions that deprioritized the deportations of undocumented immigrants with no criminal records. DREAMers also got letters stating that any removal actions against them would be deferred for two years, during which they had permission to work.

On Tuesday, Magistrate Judge James Donohue asked the Department of Homeland Security and other respondents to address by Thursday morning whether Ramirez was still being detained and if so, why, given that he was granted deferred action under DACA.

Donohue also asked federal officials to address whether Ramirez has been placed in removal proceedings, questions about any possible bond hearing for Ramirez, and what the court's authority is to order an immigration judge and the Board of Immigration Appeals to act.

A hearing on the matter was set for Friday.

"If petitioner is still detained and removal proceedings have not been initiated against him, what is the basis for ICE’s authority to detain him?" Donohue asked. "What limitations are there, if any, on the Court’s ability to hold a detention hearing for petitioner before the merits of his habeas petition have been decided?"

Rose Richeson, an ICE spokesperson, said in a statement that Ramirez was detained because he was a “self-admitted gang member.”

“ICE officers took Mr. Ramirez into custody based on his admitted gang affiliation and risk to public safety,” Richeson said.

In a statement Wednesday, the Department of Homeland Security said immigrants granted deferred action from deportation who are then found to pose a "threat to national security or public safety may have their deferred action terminated at any time and DHS may seek their removal from the United States."

Ramirez was transferred to the Northwest Detention Center in Tacoma, Washington, and was expected to face deportation proceedings with the Department of Justice’s Executive Office for Immigration Review, Richeson said.

One of Ramirez's lawyers called the ICE statement "inaccurate."

"Mr. Ramirez unequivocally denies being in a gang. While in custody, he was repeatedly pressured by US Immigration and Customs Enforcement agents to falsely admit affiliation," Mark Rosenbaum, counsel for Ramirez, said in a statement. "The statement issued tonight by Ms. Richeson of US Immigration and Customs Enforcement is inaccurate."

In court documents filed Thursday, federal authorities said Ramirez an ICE officer that he “'used to hang out with
the Sureno’s in California,'” that he “'fled California to escape from the gangs.'”

“This is false. Mr. Ramirez did not say these things because they are not true," Rosenbaum said. "And while utterly implausible and wholly fabricated, these claims still would not be sufficient evidence that Mr. Ramirez is a threat to the public safety or national security."

Bryan Cox / ICE

Ramirez’s lawyers allege that by detaining him despite him having the protections afforded by DACA, federal officials violated his due process and Fourth Amendment rights. He appears to be one of the first — if not the first — DACA recipient to be detained since Trump took office.

“In establishing DACA, the federal government created a clear and reasonable expectation among DACA recipients that they would be able to live and work in the United States without being subjected to arrest and deportation,” said Mark Rosenbaum, one of his attorneys. “Bait-and-switch sullies the integrity of our nation’s core values.”

Trump has for months pledged to end DACA, calling it "one of the most unconstitutional actions ever undertaken by a president." But he hasn’t made a move against the program, which remains on the books.

According to the lawsuit, Ramirez, 23, has twice been granted deferred action under the program and renewed his status on May 5, 2016.

Bryan Cox / U.S. Immigration and Customs Enf

Foreign nationals were arrested this week during a targeted enforcement operation.

“In granting Daniel DACA status, the federal government has twice determined — after intensive scrutiny — that he presents no threat to national security or public safety,” said another one of Ramirez's attorneys, Theodore J. Boutrous, a partner at Gibson Dunn.

He is joined in the lawsuit by Erwin Chemerinsky, Laurence Tribe, lawyers from Public Counsel, Barrera Legal Group, Hawkins Law Group, and Northwest Immigrants Rights Project.

Ramirez was asleep at his father’s home in Seattle when ICE agents with an arrest warrant detained his father, the lawsuit states. His father was allowed to re-enter his home to tell his two sons about his arrest. It was when the ICE agents entered the home that they asked Ramirez, “Are you legally here?”

“Yes, I have a work permit,” Ramirez said, according to the lawsuit.

He declined to answer more questions and ICE agents took him to a processing center in Seattle and eventually booked into a detention center despite having been shown the work permit obtained through DACA, his attorneys said.

The lawsuit was filed against the Department of Homeland Security and ICE in US District Court for the Western District of Washington. In adding the warden of the Northwest Detention Center, where Ramirez allegedly is being held, as a respondent in the case, Donohue noted that "generally, the proper respondent in a habeas action is the warden of the facility where the petitioner is detained."