A federal judge in San Francisco blocked the Trump administration from overturning portions of a George H.W. Bush-era humanitarian policy that offers U.S. residency to nationals from countries facing perilous conditions.

The decision temporarily protects about 300,000 people from El Salvador, Honduras, Nicaragua and Sudan from mass deportations at the hands of Trump’s Department of Homeland Security. More broadly, U.S. District Judge Edward Chen’s preliminary injunction halts the administration from stripping those four nations of their Temporary Protected Status, which recognizes that they are dangerous places to live due do natural disasters, drug epidemics or armed conflict.

The Justice Department...