President Donald Trump’s November 9 proclamation restricting asylum for immigrants who cross the border into the US illegally has been shot down by a US District Judge in San Francisco.

The judge halted Trump’s restriction on asylum seekers, clearing the way for the thousands-strong caravan of Central American migrants to eventually seek citizenship in the US.

The US is part of pacts with the UN and has laws on the books in Congress that guarantee anyone the right to seek refugee status and asylum in the country.

The judge ruled that Trump can’t override Congress on this one.

President Donald Trump’s attempt to restrict asylum for immigrants who cross the border into the US illegally has been shot down by a US District Judge in San Francisco, clearing the way for migrant caravan to seek asylum and eventually citizenship.

On Twitter, Trump said “some very bad thugs and gang members,” as well as “criminals and unknown Middle Easterners” were in the caravan.

Trump tried to restrict asylum rules in a proclamation on November 9, citing national security concerns and stresses on the immigration and asylum systems that stall applications.

Senior administration officials told reporters at the time of the proclamation that the current asylum system is currently backlogged with roughly 800,000 cases and in a “full-fledged and very large crisis.”

Read more: Tensions are growing in Tijuana as 3,000 migrants arrive at the US border, a number officials expect to grow to 10,000 as asylum cases take months to process

Before the midterm elections, Trump campaigned hard on his stance against letting the migrants seek asylum, often accusing Democrats, without evidence, of coordinating the caravan.

Lees ook op Business Insider Medisch directeur Mariëlle Bartholomeus van ‘coronaziekenhuis’ Bernhoven verkozen tot topvrouw van het jaar

Following the election, Trump has made little mention of the caravan outside the proclamation.

Current law allows for anyone, regardless of how they enter the country, to apply for asylum, which can lead to eventual citizenship.

Asylum seekers to the US must prove that they legitimately fear persecution based on their race, nationality, religion, politics, or social group either from the government or forces the government cannot control.

The migrants have fled Central American countries including Honduras, Guatemala, and El Salvador, which suffer from extremely concentrated violence their governments have failed to rein in.

But Trump’s demand that asylum seekers from the caravan must enter the US through one of 26 legal ports didn’t sway the district court.

“Whatever the scope of the president’s authority, he may not rewrite the immigration laws to impose a condition that Congress has expressly forbidden,” Judge Jon S. Tigar wrote in his decision against Trump, the Washington Post noted.

“Failure to comply with entry requirements such as arriving at a designated port of entry should bear little, if any, weight in the asylum process.”

Read more: The first group of caravan migrants has reached the US border while thousands of others lag behind – here’s what awaits them when they arrive

The US is part of United Nations compacts, and has laws on the books with Congress, that guarantee the right of migrants to seek refugee status or asylum.

Trump’s order would render illegal border crossers unable to seek asylum, thereby effectively waiving their rights, the judge ruled.

The White House usually appeals losses in court like this. While courts have knocked back much of Trump’s immigration agenda, his travel ban was eventually upheld by the Supreme Court after some modification.