Judge Richard Seeborg in San Francisco granted a request on behalf of 11 asylum seekers from Central America and legal advocacy groups to halt the practice while their lawsuit moves forward, but he held off on enforcing his decision until Friday to give the government a chance to ask an appeals court for a review.
It was not immediately clear whether the administration would ask an appeals court to put the ruling on hold. The U.S. Department of Justice declined to comment. Trump tweeted that the ruling was "unfair to the U.S."
The launch of the policy in January at the nation's busiest border crossing — in San Diego — marked an unprecedented change to the U.S. asylum system, government officials and asylum experts said. Families seeking asylum typically have been released in the U.S. with notices to appear in court.
The Trump administration says the policy responds to a crisis at the southern border that has overwhelmed the ability of immigration officials to detain migrants. Growing numbers of families are fleeing poverty and gang violence in Guatemala, Honduras and El Salvador.
The ruling came a day after Homeland Security Secretary Kirstjen Nielsen resigned and as the administration faces repeated court setbacks on strict anti-immigration measures that were a signature campaign promise for Trump, including losses on such policies as separating families at the border and ending protections for young immigrants.
The lawsuit says the Trump administration is violating U.S. law by failing to adequately evaluate the dangers that migrants face in Mexico.
Under the new policy, asylum seekers are not guaranteed interpreters or lawyers and don't get to argue to a judge that they face the potential of persecution or torture if they are sent back to Mexico, Judy Rabinovitz, an attorney for the American Civil Liberties Union, said at a March court hearing.
Seeborg said in his ruling that "further procedural protections would be required to conform to the government's acknowledged obligation to ensure aliens are not returned to unduly dangerous circumstances."
The ACLU and other groups also argue in the lawsuit 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.
"Try as it may, the Trump administration cannot simply ignore our laws in order to accomplish its goal of preventing people from seeking asylum in the United States," Rabinovitz said in a statement after the ruling.
The administration hopes that making asylum seekers wait in Mexico will discourage weak claims and help reduce an immigration court backlog of more than 800,000 cases.
Justice Department attorney Scott Stewart said at the March hearing that there was a process to protect immigrants who could face harm in Mexico. All 11 plaintiffs in the lawsuit are represented by attorneys, and 10 already have appeared for court proceedings, he said.
Border Patrol arrests, the most widely used gauge of illegal crossings, have risen sharply over the last year but are relatively low in historical terms after hitting a 46-year low in 2017.
The launch of the policy followed months of delicate talks between the U.S. and Mexico. Mexicans and children traveling alone are exempt from it.
Thanawala reported from Atlanta.