A federal judge has ordered the release of a 20-year-old Tongan man who was legally admitted to the United States and found that Immigration and Customs Enforcement (ICE) agents “coerced” him into signing a document that the government later claimed waived his rights to challenge deportation.

In a 3-page order issued Tuesday, U.S. District Judge Noël Wise of the Northern District of California ruled that ICE coerced Cornelius Kaihau Holani—a 20-year-old citizen of New Zealand of Tongan ethnicity with no criminal record or prior immigration enforcement history—into signing a document after detaining him at Oakland International Airport and transporting him to an ICE office in San Francisco.

The ruling is a blow to the Trump administration’s deportation system, with the court finding that federal immigration officials likely violated basic due process protections.

The government later relied on the document to argue that Holani had waived his right to contest removal from the United States or seek adjustment of status, according to the ruling.

Judge Wise, a Biden appointee, said ICE officers detained Holani on July 31 as he waited to board a domestic flight from Oakland to Seattle. Court records say that four plainclothes agents approached him, handcuffed him and transported him to an ICE office at 630 Sansome Street in San Francisco.

Once there, Holani was presented with a document and instructed to sign it, according to the order. When he asked whether it was related to deportation, an officer allegedly told him, “No, it’s nothing like that.” Wise wrote that Holani signed the document without knowing its contents and that the government now cites it as evidence that he relinquished his ability to challenge removal from the country.

Wise found that Holani had demonstrated a strong likelihood that he was entitled to a hearing before an immigration judge before being detained. The judge also concluded that continued detention would cause “irreparable harm” and that the balance of equities favored the man.

Federal courts have repeatedly gone toe-to-toe and squared off with the Trump administration’s lawyers at the Justice Department over the scope of ICE’s enforcement powers, and judges in a series of cases have sought to rein in actions they found may have violated due process protections.

The administration and DHS officials, meanwhile, have frequently pushed back against adverse rulings, accusing judges who block immigration actions of being “activist judges” and improperly interfering with the administration’s enforcement agenda.

The court ordered the government to return Holani to the Northern District of California and release him from custody by 11 p.m. Pacific Time on August 4. Wise also barred federal authorities from re-detaining or removing him from the United States until the court holds a hearing or the government provides him with a hearing.

The government was directed to file a status report confirming Holani’s release by August 5 and to respond to his filing later the same day. A hearing is scheduled for August 13.