FILE - Children observe the movements of the US Border Patrol agents from the Mexican side where the border meets the Pacific Ocean, Tijuana, Mexico.
FILE - Children observe the movements of the US Border Patrol agents from the Mexican side where the border meets the Pacific Ocean, Tijuana, Mexico.

A federal judge has blocked a Trump administration policy of requiring asylum-seekers to remain or return to Mexico while their petition is being processed. 

U.S. District Court Judge Richard Seeborg in California made the ruling a day after Department of Homeland Security Secretary Kirstjen Nielsen resigned.

The injunction will go into effect Friday, giving the administration time to appeal. 

The Migrant Protection Protocols program, informally known as "Remain in Mexico," was put into place in January at the San Ysidro port of entry in California and was expanded to include entry points in Calexico and El Paso. Nielsen had recently ordered the program be expanded to other entry points. 

The policy lacks sufficient protections to ensure migrants don't face "undue risk to their lives or freedom'' in Mexico, the ruling said. 

The Trump administration has defended the policy, saying it is in response to a crisis at the southern border that has overwhelmed the ability of immigration officials to detain migrants. 

President Donald Trump objected to the ruling on Twitter, calling it "So unfair to the U.S."

Human rights groups and immigration activists had argued in a lawsuit filed on behalf of 11 asylum-seekers from Central America that a law allowing the return of some immigrants to Mexico does not apply to asylum seekers who cross the border illegally or arrive at a border crossing without proper documents.

Seeborg agreed, saying the "plain language'' of the law supported that interpretation.

The judge gave the government two days to allow the asylum seekers to enter the United States, and said they could be subject to detention or parole while they await adjudication of their admission application.

It is not clear if the Trump administration will appeal the ruling.