A federal judge on Friday ordered the Biden administration to "enforce and implement" the Trump-era Remain-in-Mexico policy in response to a lawsuit from Texas and Missouri, which claimed that the administration’s attempt to terminate the policy was illegal and harmful.

The two Republican states had sought a preliminary injunction against the administration’s June 1 memo formally ending the policy -- officially called the Migrant Protection Protocols (MPP). They argued that the ending of the policy was in breach of the Administrative Procedures Act (APA).

MISSOURI AG ‘OPTIMISTIC’ AHEAD OF HEARING CHALLENGING BIDEN REVERSAL OF REMAIN-IN-MEXICO' POLICY

The ruling by Judge Matthew Kacsmaryk, orders the Biden administration "to enforce and implement MPP in good faith" until it has been "lawfully rescinded" in compliance with the APA, and until the federal government has enough detention capacity to detail all migrants subject to mandatory detention. 

However, it notes the injunction is narrow and also states: "Nothing in this injunction requires DHS to take any immigration or removal action nor withhold its statutory discretion towards any individual thatit would not otherwise take."

However, the court has stayed the applicability of the opinion and order for 7 days to allow the government to appeal it.

"My office has been leading the way nationally in fighting human trafficking, and the Biden Administration’s lax border policies increase the risk for human trafficking at the border and, in turn, in Missouri," Missouri Attorney General Eric Schmitt said in a statement. "Today’s massive win was crucial – re-implementing the Migrant Protection Protocols will help secure the border and fight the scourge of human trafficking."

"Together we sued, and just handed Biden yet another major loss!" Texas Attorney General Ken Paxton's office tweeted.

MPP was established and expanded in 2019 by the Trump administration and involved sending migrants back to Mexico, rather than being released into the U.S., as their asylum proceedings were heard.

MAYORKAS ANNOUNCES 212,672 MIGRANT ENCOUNTERS IN JULY, SAYS BORDER ‘IS ONE OF THE TOUGHEST CHALLENGES WE FACE’ 

The policy, in cooperation with Mexico, resulted in court tents being set up along the border in places like Laredo, Texas, where migrants could briefly enter for their hearings before going back to Mexico.

The Trump administration argued that the policy ended "catch-and-release" -- by which migrants were released into the U.S. -- which it saw as a major pull factor drawing migrants north. Critics said the policy was cruel and led to migrants being put in danger in camps across the border.

The Biden administration promised to end the policy and began processing migrants enrolled in MPP into the U.S. shortly after entering office. In June, it formally ended the program.

Missouri and Texas sued the administration claiming that ending the policy was both illegal in the way that it was done, and that it harmed both border states and states deeper in the interior by encouraging migrants and therefore fueling the crisis at the southern border.

"We are hopeful for a favorable ruling because it is clear that the Biden administration didn’t consider anything relevant to how it was working or notice and comment, and obviously we have a crisis at the border now," Schmitt told Fox News in an interview last month. "Anyone who is paying attention knows we have a 21-year high in border crossings, drug traffickers, and human traffickers have been emboldened, and that affects not just Texas but states like Missouri."

The lawsuit claimed some of the migrants released would commit crimes in their states, that it would lead to an increase in human trafficking, and that it would lead to higher costs for the states in areas like education and healthcare.

The ruling found that the termination of MPP "has contributed to the current border surge" and that DHS counsel had conceded as much. The judge also noted the increase in border apprehensions from fewer than 80,000 in January to about 173,000 in April when the lawsuit was filed. In July, there were more than 212,000 encounters at the border.

MAYORKAS SAYS BORDER CRISIS ‘UNSUSTAINABLE’ AND ‘WE’RE GOING TO LOSE' IN LEAKED AUDIO 

The ruling found that the states have shown they will suffer injury attributable to the ending of MPP, since it leads to more migrants being released and paroled into their states. It also found that DHS Secretary Alejandro Mayorkas failed to consider a number of factors, including some of the main benefits of MPP.

The ruling accuses Mayorkas of not having addressed the problems created by false asylum claims, that it discouraged migrants from traveling, or that DHS had previously found that 9 out of 10 asylum claims from Northern Triangle countries are ultimately found not to have merit.



"By ignoring its own previous assessment on the importance of deterring meritless asylum applications without ‘a reasoned analysis for the change,’ defendants acted arbitrarily and capriciously."

CLICK HERE TO GET THE FOX NEWS APP

The ruling also accused Mayorkas of not having considered warnings that ending MPP would lead to a surge in migrants crossing the border, and that he didn’t consider the costs to the states. Kacsmaryk also said he found DHS arguments, such as the potential negative effect on diplomatic relations, "unpersuasive."

While Kacsmaryk says the court does not have the authority to tell a DHS employee which individual migrants must be enrolled in MPP, it finds that it can enjoin a blanket policy that again allows front line Customs and Border Protection (CBP) officers to use MPP to return migrants to Mexico.