Asylum seekers are often imprisoned in immigration detention for weeks or months before they can ask a judge to release them, even though they’re entitled to bond hearings. But this injustice may soon be corrected for some asylum seekers.

On Friday, a U.S. district court judge ruled that certain detained asylum seekers must receive a bond hearing within seven days of requesting one. The Seattle judge also ordered that immigration courts must provide legal protections at the hearings.

The ruling in the Padilla v. ICE case is a defeat for the Trump administration. It strikes a blow against the ongoing campaign to punish and deter migrants from seeking asylum.

Judge Marsha J. Peckman ordered the immigration courts to:

  • Provide certain detained asylum seekers with a bond hearing within 7 days of requesting one.
  • Put the burden of proof on the Department of Homeland Security—not the asylum seekers—to justify continued detention.
  • Record or provide a transcript of the hearings.
  • Issue a written decision that explains why an immigration judge decides to grant or deny bond at the time the decision is made.

The case is a nationwide class action brought by detained asylum seekers. The decision, which grants their motion for a preliminary injunction, applies to all detained asylum seekers who entered the United States between ports of entry and then passed an initial screening on their asylum claims called a credible fear interview. The American Immigration Council and Northwest Immigrant Rights Project represent the asylum seekers.

This order could drastically change the situation of thousands of detained asylum seekers. Many would no longer need to wait for weeks or months to get a bond hearing.

The order would also put in place important legal protections. Currently, even once they receive bond hearings, asylum seekers are at a disadvantage. They are often unable to gather evidence or obtain legal representation to help with their bond requests while behind bars. Yet, the courts still require they bear the burden of proof to show why they should be released.

Under this system, asylum seekers also are often left in the dark about why their bond requests are denied. Bond hearings are not generally recorded. Judges also don’t have to explain in writing why they denied bond until after an immigrant has already appealed the decision. This creates serious problem for asylum seekers trying to appeal bond denials.

These unfair practices leave many immigrants incarcerated during the entire, lengthy asylum process. Immigrants forced to stay in detention are less likely to succeed in their asylum cases. Some may even give up valid claims to remain in the United States to get out of unsafe detention conditions.

The ruling is set to take effect within 30 days. However, the government could appeal the decision to a higher court or take other steps to prevent it from going into effect in those 30 days.

This decision is still a first step towards ensuring asylum seekers have access to prompt, fair bond hearings.