SAN FRANCISCO — A federal appeals court decided 2-1 Monday that the Trump administration may deport hundreds of thousands of immigrants who previously received temporary protected status for humanitarian reasons.

The 2-1 ruling by a panel of the 9th U.S. Circuit Court of Appeals overturned an injunction protecting immigrants from El Salvador, Haiti, Nicaragua and Sudan from being deported pending litigation.

The Trump administration ended their protections, saying their home countries were now safe for them.

The decision affects 300,000 noncitizens and 200,000 of their children who are U.S. citizens.

Judge Consuelo Callahan, writing for the majority, said federal law does not permit the judiciary to second-guess decisions by the secretary of Homeland Security on which countries’ citizens receive protected status.

“To the extent the TPS statute places constraints on the Secretary’s discretion, it does so in favor of limiting unwarranted designations or extensions of TPS,” wrote Callahan, an appointee of President George W. Bush.

She was joined by Judge Ryan Nelson, an appointee of President Donald Trump.

Judge Morgan Christen, an appointee of President Barack Obama, dissented. She said the Trump administration had changed policy and practice without public review. She described the administration’s action as “an abrupt and unexplained change.”

She noted the lawsuit challenging the deportation notices said they were motivated by racial and ethnic bias.

Trump reportedly called Haiti and El Salvador “s---hole countries” and characterized immigrants from Mexico and Central America as criminals and snakes.

“We cannot sweep aside the words that were actually used, and it would be worse for us to deny their meaning,” Christen wrote.

The decision will likely be appealed.

A statement by the ACLU Foundation of Southern California, which represented the immigrants and their children, said the ruling would not immediately end temporary protected status. Such holders from these countries will be permitted to maintain their status until at least February, and those from El Salvador until at least November.