A federal judge on Tuesday blocked an order from Attorney General William Barr that stated certain asylum-seekers can be detained indefinitely.

U.S. District Judge Marsha Pechman in Washington state wrote that it was "unconstitutional" to deny asylum-seekers a bond hearing while they wait for their asylum claims to be processed.

"It is the finding of this Court that it is unconstitutional to deny these class members a bond hearing while they await a final determination of their asylum request," Pechman, a Clinton appointee, wrote in her ruling.

The judge had issued a preliminary injunction earlier this year that required asylum-seekers who are given a hearing in their proceedings to be released within seven days after that hearing is granted.

The Trump administration had asked her to dismiss that ruling after Barr issued his new asylum order. But Pechman rejected the request in her order on Tuesday, finding that the policy implemented by Barr's order was unconstitutional.

The attorney general had written in the order, issued in April, that asylum-seekers who are able to demonstrate a "credible fear" and are sent to full deportation proceedings cannot be released on bond.

That directive overturned a ruling by the Board of Immigration Appeals in 2005 that found asylum-seekers could be released on bond if they are able to exhibit they have credible fear of persecution or danger if they leave the U.S.

"I conclude that such aliens remain ineligible for bond, whether they are arriving at the border or are apprehended in the United States," Barr wrote at the time, invoking a statute included in the Immigration and Nationality Act.

Pechman wrote that she was adjusting her previous preliminary injunction requiring the release of those impacted asylum-seekers to also address Barr's order and that the new injunctions will go into effect within 14 days of being issued.

The judge cited a previous Supreme Court ruling that "definitively established the immigrant detainees' constitutionally-protected interest in freedom from unnecessary incarceration."

And she wrote that the immigrants "are entitled to due process protections," including a "longstanding prohibition against indefinite civil detention with no opportunity to test its necessity."

"The Court finds that Plaintiffs have established a constitutionally-protected interest in their liberty, a right to due process which includes a hearing before a neutral decisionmaker to assess the necessity of their detention, and a likelihood of success on the merits of that issue," Pechman wrote.

And the judge again ruled that the asylum-seekers are likely to face "irreparable harm" under the policy.

"All the harms attendant upon their prolonged detention cited in the original ruling on Plaintiffs' request for injunctive relief remain applicable here - substandard physical conditions, low standards of medical care, lack of access to attorneys and evidence as Plaintiffs prepare their cases, separation from their families, and re-traumatization of a population already found to have legitimate circumstances of victimization," the ruling states.

Pechman also pushed back against the administration's argument that the potential harm was "speculative," saying that those claims "lack substance."

However, she said she didn't believe that the asylum-seekers would win by alleging that Barr violated federal administrative law with his order.

The Hill has reached out to the Justice Department for comment.

Several immigration groups had challenged the policy in court on behalf of the asylum-seekers.

Michael Tan, a senior staff attorney with the American Civil Liberties Union's Immigrants' Rights Project, said in a statement that the Trump administration "cannot circumvent the Constitution in its effort to deter and punish asylum-seekers applying for protection."

Trina Realmuto, the directing attorney of the American Immigration Council, also celebrated the order.

"Today's decision safeguards many asylum-seekers from the attorney general's unlawful efforts to keep them incarcerated indefinitely while they seek protection from persecution and ensures that they have prompt bond hearings with basic due process protections," Realmuto said.

And Matt Adams, the legal director of the Northwest Immigrant Rights Project, said in a similar statement that "thousands of asylum-seekers will continue to be able to seek release on bond, as they seek protection from persecution and torture."

The ruling comes amid attempts by the Trump administration to crack down on asylum rules.

President Trump late last month had delayed planned immigration raids, saying that Congress had two weeks to pass restrictions on the asylum laws. But the president said Monday that those raids would begin after July Fourth.

House Democrats have opposed passing any asylum restrictions, and much of the two-week period takes place as lawmakers are away from Capitol Hill on recess.