U.S. District Judge Marsha Pechman ruled that asylum seekers who are detained after entering the country and found to have a credible fear of returning home are entitled to prompt bond hearings. The ruling was in response to a lawsuit brought by the Northwest Immigrant Rights Project, among other immigrant-rights groups.

“The purposes of immigration detention are simple and straightforward: to facilitate removal (if removal is deemed justified), and to prevent flight and harm to the community,” reads Pechman’s order.

“Detention that does not serve those legitimate ends violates due process; bond hearings are the most efficacious mean[s] of insuring those purposes are being served,” Pechman wrote, while noting that “freedom from imprisonment” constitutes the core of the Fifth Amendment of the U.S. Constitution.

Pechman added that lengthy detentions might also lead some asylum seekers to “simply abandon their claim and accept deportation back to countries where, as it has already been established to the government’s satisfaction, they face persecution, torture, and possibly death.”

According to Pechman’s ruling, asylum seekers should be given bond hearings within seven days of requesting them.

Pechman said the Trump administration would have 14 days to implement her order.

The Department of Justice did not immediately respond to Crosscut's request for comment.

The Northwest Immigrant Rights Project, the American Civil Liberties Union and the American Immigration Council initially brought forward the lawsuit in question to challenge the legality of Trump’s zero-tolerance policy and family separation. Mothers who were separated from their children at the border and detained in Washington were at the center of the suit.

After the administration pulled back from zero tolerance, the lawsuit was modified to focus on the federal government’s practice of prolonging an asylum seeker’s detention by failing to provide bond hearings.

Back in April, Yolany Padilla, the first parent to be released and reunited with her child in Washington and one of a number of parents at the center of the lawsuit, scored a victory in U.S. District Court for the Western District of Washington. That decision, also made by Pechman, placed the burden on the Department of Homeland Security to present a reason as to why an asylum seeker should be denied bond. Pechman ruled that asylum seekers are eligible for bond unless they pose a flight risk or a danger to the community. She gave the government 30 days to implement her order.

But before those 30 days were up, U.S. Attorney General William Barr directed immigration judges to deny migrants seeking asylum the opportunity to have a bond hearing. Barr gave the Department of Homeland Security 90 days to implement his new procedure, pitting a federal judge against the Trump administration.

Matt Adams, legal director at the Northwest Immigrant Rights Project, called Tuesday’s ruling “a huge first step.” Adams estimated there are currently 20,000 to 40,000 asylum seekers locked up. According to the Transactional Records Access Clearinghouse (TRAC), about half of bond motions are granted.

But Adams said he expected the federal government to appeal the ruling, which would send the case to the 9th Circuit Court of Appeals.

In a statement, Michael Tan, senior staff attorney with the ACLU’s Immigrants’ Rights Project said: “The court forcefully rejected the Trump administration’s bid to arbitrarily jail asylum-seekers without a hearing.”

“Try as it may,” Tan wrote, “the administration cannot circumvent the Constitution in its effort to deter and punish asylum seekers applying for protection.”