A federal judge in California issued an order Monday blocking the Trump administration's policy of returning some asylum-seekers to Mexico while they wait for a court appearance.

U.S. District Court Judge Richard Seeborg's nationwide ruling will not go into effect until Friday, to give the administration time to appeal.

Outgoing Homeland Security chief Kirstjen Nielsen announced the launch of the Migrant Protection Protocols in San Diego, the country's busiest border crossing, in January. Under the policy, Customs and Border Protection officers and agents have the authority to turn around asylum-seekers crossing in the San Diego and El Paso sectors. Families seeking asylum had previously been allowed to stay in the United States while awaiting their court hearings.

A lawsuit filed on behalf of 11 asylum-seekers from Central America had argued that being sent back across the border could expose them to "undue risk to their lives or freedom."

Seeborg found the asylum-seekers had enough of a case to issue a temporary order blocking the policy.

Advocacy groups involved in the suit hailed the decision.

“Remain in Mexico leaves individuals and families fleeing persecution stranded on the other side of the border, when what they need and deserve under our laws is protection in America,” said Archi Pyati, chief of policy for Tahirih Justice Center. “This policy goes against basic tenets of fairness, and makes it all but impossible for us to do our jobs. We are glad to see justice served.”

NBC News reported last week that Nielsen announced that she would be increasing the number of Central American asylum-seekers who are made to wait in Mexico until they can see a U.S. immigration judge.

Seeborg's ruling means "you can't do this where you’ve been doing it and you can’t expand it where you want to expand it," Judy Rabinovitz, who argued the case for the ACLU, told NBC News.

She said the policy had been "a complete change in how our asylum system works," and it had left asylum-seekers without any supports in Mexico, where there's a "lot of hostility towards migrants and a lot of lawlessness involving Mexican authorities." She estimated that hundreds of asylum-seekers had already been sent back into Mexico, with no clear way of coming back in for their hearings.

The Justice Department did not immediately respond to a request for comment. Any appeal of the decision would be heard by the Ninth Circuit Court of Appeals, an appeals court that President Donald Trump has repeatedly blasted as a "disgrace" for ruling against his policies.

"A 9th Circuit Judge just ruled that Mexico is too dangerous for migrants. So unfair to the U.S. OUT OF CONTROL!" the president said in a tweet Monday night.

Daily border crossings have surpassed a 13-year high as the number of undocumented Central American migrants, mainly families with children seeking asylum, has increased in recent months.

In her announcement, Nielsen directed border agents to "return hundreds of additional migrants per day above current rates." It is not known how many migrants have been returned already.

The administration hopes that making asylum seekers wait outside the U.S. will discourage weak claims and help reduce an immigration court backlog of more than 800,000 cases.