Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A federal appeals court on Friday delivered two blows to the Trump administration's immigration policy, ruling against a program to force migrants seeking asylum to wait in Mexico and against a rule severely limiting the number of migrants who were eligible for asylum.

Hours later, however, the 9th Circuit Court of Appeals paused its ruling after government lawyers argued it would imperil communities along the border as an estimated 25,000 asylum seekers who were encouraged to stay in Mexico got the green light to come north and argue their cases.

The court's suspension of its own ruling came as Chad Wolf, the acting Homeland Security secretary, said he was working with the Justice Department to appeal the earlier ruling Friday "expeditiously."

That 2-1 decision was to reinstate a block on the policy forcing migrants seeking asylum in the U.S. to wait in Mexico while their cases play out. The court also ruled in a separate, 3-0 decision, to uphold a block on a rule seeking to bar asylum eligibility for migrants who cross the border between ports of entry.

In the remain-in-Mexico case, the court said it concluded that the policy, known formally as the Migrant Protection protocols, or MPP, “was invalid in its entirety” due to inconsistencies with the law and should be "enjoined in its entirety."

"The court has finally affirmed what we always knew to be the case, that the provision on which the government is relying does not apply to asylum-seekers. Full stop," Melissa Crow, senior supervising attorney at the SPLC’s Immigrant Justice Project, told NBC News.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

In the other case, the court said it upheld an injunction against a policy that "strips asylum eligibility from every migrant who crosses into the United States between designated ports of entry."

"Once again the courts have recognized there is tremendous danger facing asylum seekers along the entire southern border, and that the administration cannot unilaterally rewrite the laws,” said American Civil Liberties Union attorney Lee Gelernt in a statement

About 60,000 migrants have been placed under the remain-in-Mexico program since it began more than a year ago on the border separating Tijuana from San Diego.

In April, a federal judge temporarily blocked the policy — but just a month later, a court of appeals granted the Trump administration's request to allow the rule to take effect as the legal challenge played out. In October, the appeals court heard arguments in the challenge to the policy.

"The ruling is a really big deal," said Jessica Bolter, associate policy analyst at the Migration Policy Institute. "But it's unclear how long it will be in effect. The government will likely appeal it to the Supreme Court."

"The Supreme Court has tended to side with the administration on most immigration cases, although with some exceptions," she said.

Bolter said the court's decision did not directly address what would happen to the tens of thousands of people already in Mexico.

The Departments of Homeland Security and Justice did not immediately respond to requests for comment.

But the administration has previously defended the remain in Mexico policy.

In late January, the anniversary of the policy, spokesperson Heather Swift said in a statement to NBC News that the U.S. and Mexican governments “100 percent support MPP, which is firmly authorized by bipartisan Congressional statute and has allowed the U.S. to provide the opportunity for due process to more than 57,000 migrants.”

“DHS is always looking at ways to expand and strengthen the program to include new locations, populations, and procedures in order to further enhance protections for migrants and ensure safe and lawful migration, while deterring smugglers and traffickers,” she said. “We continually work with Mexico and have provided more than $17 million in aid for safety and security measures. MPP is one of the most important and effective tools we have implemented to confront the crisis on the border and we will continue to strengthen and expand.”

The government has also defended the restrictions on asylum for those who cross the border between ports of entry.