A federal judge ruled Wednesday that a DREAMer who had protection from deportation and was arrested during an immigration raid can challenge the Department of Homeland Security’s actions after government lawyers tried to get the case dismissed.

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

"At this stage of the proceedings, the Court is satisfied that Plaintiff has raised a plausible due process claim that will not be dismissed," said Judge Ricardo Martinez of the US District Court for the Western District of Washington.

Federal immigration authorities had argued that Ramirez’s DACA status was terminated the day he was sent a notice to appear in immigration court after his arrest. Days after that notice, United States Citizenship and Immigration Services, which oversees the DACA program, sent him a notice that said his deferred action and employment authorization were being terminated because of the notice to appear. The notice said the decision could not be appealed.

Ramirez was eventually released on March 29, 2017, when he received a bond hearing in immigration court.

Ramirez is accusing federal agencies of violating the Administrative Procedures Act because revoking his DACA doesn’t fit the government's procedures for terminating it “and was therefore arbitrary and capricious.”

He is also accusing the feds of violating his Fifth Amendment right to due process.

Ted S. Warren / AP

Lawyers for the Department of Homeland Security argued that the Immigration Nationality Act (INA) bars the court from hearing the case because the decision on whether to revoke or grant someone DACA is discretionary. The federal government also said the INA precludes the court from reviewing the notice to appear, which is what terminated Ramirez’s DACA.

The judge agreed that if Ramirez were asking the court to review the government’s ultimate decision to terminate his DACA status, he would be unable to under the law.

However, the judge said, those rules don't apply to the narrower issue of whether the immigration agents complied with their own procedures when taking Ramirez into custody and questioning him – the actions that led to the termination of his DACA status.

Lawyers for DHS also said that because the government is allowed to take away a person’s DACA at any time for no reason, Ramirez can’t say his due process rights were violated because no process is actually owed to them.

“That cannot be,” Judge Martinez said. “The representations made to applicants for DACA cannot and do not suggest that no process is due to them, particularly in [Ramirez’s] case where benefits have already been conferred.”

Specifically what due process Ramirez and other DACA recipients are owed is a fight for another day, Martinez said.

One of Ramirez’s attorneys Ethan Dettmer, a partner at Gibson, Dunn & Crutcher, said the decision was a victory for all Americans who believe the government should be accountable for the promises it makes.

“The Government claims that it can break its promises to the Dreamers for any reason or for no reason at all,” Dettmer said in a statement. “The Court asked the Government whether that could be fair or just, and this order makes clear that the answer to that question is ‘no.’”

Ted S. Warren / AP

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 order that halted the deportation of undocumented immigrants with no criminal records. Under that order, DREAMers received letters stating that any removal actions against them would be deferred for two years, during which they had permission to work.

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.

After Ramirez was taken into custody, ICE said he'd been detained because he was a “self-admitted gang member.” His attorneys denied that he was a member of a gang and charged that while he was in custody, ICE agents repeatedly pressured him to falsely admit to a gang affiliation.