The Department of Homeland Security says it is ready to reinstate the Trump-era Remain-in-Mexico policy by mid-November in response to a court order upheld by the Supreme Court – even as it works to abolish the program by a different method.

A federal judge on Friday ordered the Biden administration to “enforce and implement” what is formally called the Migrant Protection Protocols (MPP) 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 Supreme Court upheld the ruling.

ARIZONA AG CALLS FOR DOJ TO PROBE FACEBOOK AFTER IT SAYS USERS CAN SHARE INFO ON HOW TO ENTER US ILLEGALLY

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 immigration proceedings were heard. The Biden administration began unraveling it earlier this year, even amid soaring migrant numbers, and formally ended it in June before the court ruling ordered a reversal.

Proponents described the policy as incredibly effective, by weeding out bogus or insufficient asylum claims without letting people into the country, and one that helped end the process of “catch and release.” Amid the ongoing border crisis, which has seen hundreds of thousands of migrants hit the border in recent months, with tens of thousands being released into the U.S., Republicans and border officials have urged the Biden administration to re-implement the policy.

Sept. 17, 2021: Scenes from underneath the International Bridge in Del Rio.

However, critics called the process inhumane and one that left migrants open to violence and exploitation on the Mexican side of the border by cartels and other criminals, where migrants gathered in de facto camps.

In a filing on Thursday, the Biden administration said it had made “substantial progress” in re-implementing MPP, even as it says it is seeking alternative ways to end the program.

The filing said it had engaged in talks with Mexico, finalized operational plans and has also issued a task order to rebuild the soft-sided facilities (which were commonly referred to as “court tents”) in Laredo and Brownsville, Texas to the tune of $14.1 million — with a predicted $10.5 million a month in operational costs.

BORDER CRISIS: VIDEO SHOWS SMUGGLER ABANDON 7-YEAR-OLD MIGRANT GIRL

“As a result of this progress, DHS anticipates being in a position to re-implement MPP by mid-November dependent on decisions made by Mexico.”

The filing emphasizes “DHS cannot implement MPP without Mexico’s independent decision to accept individuals that the United States seeks to send to Mexico” and will need its concurrence on how many entries will be permitted and who will be accepted for return.

They say Mexico has identified a number of changes it would like to see made to MPP, including better coordination and an assurance that cases are generally adjudicated within six months of enrollment.

CLICK HERE TO GET THE FOX NEWS APP

In a statement DHS said it is taking “necessary steps” to comply with the order, despite its appeal and efforts to end the policy.

“As announced previously, DHS also will be issuing a memorandum terminating MPP,” a spokeperson said, adding that it would not take effect until the injunction is lifted.