The White House on Tuesday blasted a federal judge for temporarily blocking the Trump administration from refusing asylum to migrants who cross the U.S.-Mexico border illegally.

In a sharply worded statement late Tuesday afternoon, White House Press Secretary Sarah Sanders excoriated the ruling as "yet another example of activist judges imposing their open borders policy preferences." She vowed that the administration "will take all necessary action" to fight the decision.

"This decision will open the floodgates, inviting countless illegal aliens to pour into our country on the American taxpayer's dime," Sanders claimed.

In a ruling issued late Monday, U.S. District Judge Jon Tigar, who is based in San Francisco, wrote that President Donald Trump's "rule barring asylum for immigrants who enter the country" outside a port of entry “irreconcilably conflicts” with federal immigration laws and "the expressed intent of Congress."

"Whatever the scope of the President's authority, he may not rewrite the immigration laws to impose a condition that Congress has expressly forbidden," Tigar, who was nominated to the U.S. District Court for the Northern District of California by President Barack Obama, wrote.

Homeland Security Secretary Kirstjen Nielsen also condemned the ruling Tuesday at a press conference near the U.S. border in southern California.

"This is a dangerous ruling and, given last year's Supreme Court ruling on this issue, will undoubtedly be overturned," Nielsen said.

Though she said she would follow the judge's order, she said that the country's "generous asylum system" is being abused and pledged to vigorously secure the border from a caravan of migrants, mostly from Honduras, traveling toward the U.S.

She estimated that 8,000 to 10,000 migrants are attempting to gain entry in the U.S., and that roughly 500 are criminals or gang members.

"The crisis is real and it is just on the other side of this wall," she said. "DHS and the administration will continue to take all possible actions to stop the caravan from entering the United States illegally without just cause and to ensure our borders are secure."

She also claimed, citing "historical trends" and "intel" but no specific evidence, that majority of those in the caravan have "frivolous or unsubstantiated claims of asylum" and are seeking to exploit legal loopholes to gain entry into the U.S.

"Wanting a job is not a basis for asylum under U.S. law," she said. "Wanting to live in the U.S (is) not a basis of asylum under U.S. law."

Earlier this month, Trump signed a proclamation that will make it harder for immigrants to claim asylum if they are caught crossing the border between designated ports of entry, fulfilling a key midterm promise to crack down on undocumented immigrants crossing the Southwest border ahead of the expected arrival of migrant caravans heading for the U.S.

As a result of the Nov. 9 order, asylum-seekers who do not go through ports of entry were apprehended, detained and deported unless they met a higher bar, such as proving they would be tortured if they were sent home. Within hours, the American Civil Liberties Union sued to block the new restrictions, calling it "the asylum ban."

Senior administration officials told reporters on a conference call after the order was issued that the president had the legal authority to issue the order because of sections of immigration law that allow the president discretion over who is admitted into the United States — the same language the administration used to support its travel ban in court.

Under international law, however, asylum-seekers are permitted to make a claim regardless of where they enter.

In his ruling Monday — which will remain in effect for one month barring an appeal — Tigar said the Trump administration misused its authority to issue emergency regulations, and agreed with legal groups that had sued the Trump administration claiming that U.S. immigration law allows people to seek asylum even if they enter the country between official ports of entry.

Tigar also agreed with claims made by the groups that immigrants affected by the ban would “suffer irreparable injury if the rule goes into effect.”

“Asylum seekers will be put at increased risk of violence and other harms at the border, and many will be deprived of meritorious asylum claims. The government offers nothing in support of the new rule that outweighs the need to avoid these harms,” he wrote.

In a statement on the ruling, DHS defended Trump's executive action as "lawful and appropriate" in the face of an asylum system that is "broken" and "being abused by tens of thousands of meritless claims every year."

"And it is absurd that a set of advocacy groups can be found to have standing to sue to stop the entire federal government from acting so that illegal aliens can receive a government benefit to which they are not entitled," the statement continued.

As of Monday, 107 people detained between official crossings have sought asylum since Trump's order went into effect, according to the Department of Homeland Security, which oversees Customs and Border Protection.

Trump has argued that the recent caravans are a threat to national security.

According to The Associated Press, around 3,000 people from the first of the caravans have arrived in Tijuana, Mexico, across the border from San Diego, California.