Los Angeles (AFP) - A federal court in Seattle blocked a Donald Trump administration policy Tuesday that allowed asylum-seekers to be detained indefinitely without giving them a chance to be released on bail.

On April 16, Attorney General Bill Barr directed immigration judges to no longer allow asylum-seekers apprehended after entering the country illegally to post bail.

But a federal judge in Seattle, in Washington state, ruled that Barr's decree infringed on the US constitution, arguing that it prohibits arbitrary detention of individuals without giving them the opportunity to challenge the measure.

"The court forcefully rejected the Trump administration's bid to arbitrarily jail asylum-seekers without a hearing," said Michael Tan, a migrant rights lawyer for the ACLU, said in a statement.

"Try as it may, the administration cannot circumvent the constitution in its effort to deter and punish asylum-seekers applying for protection."

Under Barr's order, which would have gone into effect on July 15, thousands of migrants could have been detained for months or even years, while immigration authorities examined their cases, prompting worry and criticism from multiple civil rights organizations.

Many organizations, including the powerful ACLU, contested the order in court, which they claimed attempted to intimidate asylum-seekers.

Trump has staked his presidency on his insistence that the United States is being overrun by migrants and asylum-seekers, portraying them as a serious threat to national security.

But opponents, mostly in the Democratic Party, say his push for building more barriers on the Mexican border and his almost daily denunciations of migrants as dangerous criminals incites racial hatred.