Washington (CNN) The Supreme Court said on Wednesday that the controversial Trump administration "Remain in Mexico" asylum policy can stay in effect while legal challenges play out.

The court's order is a victory for the administration, which warned there would be a "rush to the border" if the policy that has been in effect for a year was blocked by the courts. It's a devastating loss for immigrant rights groups who say asylum seekers sent back to Mexico are living in dangerous conditions.

Justice Sonia Sotomayor would have denied the government's application, the court said.

The policy, officially known as Migrant Protection Protocols, mandates that non-Mexican asylum return to Mexico as they await hearings in the United States. It has resulted in the creation of makeshift camps where hundreds of migrants have waited for weeks, if not months, in squalid and unsafe conditions. In some cases, migrant families have opted to send children across the US-Mexico border alone.

Lawyers for the asylum seekers called the government's policy illegal and said that in the months that it has been in effect "reports of murder, rape, torture kidnapping, and other violent assaults against returned asylum seekers have climbed."

The 9th US Circuit Court of Appeals blocked the policy last month , but allowed it to remain in effect just long enough for the Supreme Court to consider whether to step in.

"Uncontested evidence in the record establishes that non-Mexicans returned to Mexico," under the program, the appeals court held, will "risk substantial harm, even death, while they await adjudication of their applications for asylum."

In court papers, Solicitor General Noel Francisco argued for the Trump administration that the policy has "dramatically curtailed the number of aliens approaching or attempting to cross the border" and noted that it has "enabled the temporary return of over 60,000."

After the appeals court blocked the policy last week, but before it issued a temporary stay of its own order, the administration argued that the ruling had created "chaos" at the US-Mexico border.

"Large groups of migrants in Mexico began arriving at multiple ports of entry along the Southwest border seeking immediate entry into the country," Francisco wrote.

Without the program, Francisco said, "Tens of thousands of migrants are likely to resume attempting to enter the United States and seeking asylum (or other relief from removal), often without merit, forcing DHS to undertake the overwhelming burden of detaining many of those aliens in the United States throughout removal proceedings (or else releasing them on parole into the interior, where many will simply disappear)."

The administration included two sworn statements of Robert E. Perez, deputy commissioner of Customs and Border Protection. Perez told the court at the end of February that if the policy were blocked "significant numbers of individuals entering the country" could exceed the government's capacity to screen people for serious medical concerns. "This is particularly concerning given the current outbreak of the coronavirus."

In a second sworn statement issued on March 3, Perez did not mention the coronavirus but dedicated his statement to how many people had tried to come over the Gateway International Bridge in Texas near campsites before the program went back into effect.

Judy Rabinovitz, special counsel in the ACLU's Immigrants' Rights Project, said asylum seekers remain in "grave danger" due to the policy.

"The Court of Appeals unequivocally declared this policy to be illegal. The Supreme Court should as well," Rabinovitz said. "Asylum seekers face grave danger and irreversible harm every day this depraved policy remains in effect."

The Justice Department said it was "gratified" with the court's action.

"The Migrant Protection Protocols, implemented pursuant to express authority granted by Congress decades ago, have been critical to restoring the government's ability to manage the Southwest border and to work cooperatively with the Mexican government to address illegal immigration," a Justice Department spokesperson said.

Sotomayor and emergency petitions

Wednesday's order is another example of the justices siding with the Trump administration's request to quash a lower court's injunction against one of its policies, and comes after Sotomayor blasted the practice last month.

In another case, Sotomayor criticized the administration for coming to the court with emergency applications, "claiming one emergency after another" in an unprecedented numbers of cases. She also criticized her conservative colleagues for so often granting those cases.

"It is hard to say what is more troubling: that the Government would seek this extraordinary relief seemingly as a matter of course, or that the Court would grant it," she wrote at the time.

"Most troublingly, the Court's recent behavior" has benefited "one litigant over all others," she added.

Her opinion triggered the President to tweet ,"this is a terrible thing to say. Trying to 'shame' some into voting her way?" and suggest Sotomayor recuse herself from "Trump-related" cases.

This story has been updated with additional information on the policy and court's action.