A U.S. appeals court in California ruled on Thursday that President Donald Trump's administration must continue a program begun under former President Barack Obama that protects hundreds of thousands of immigrants who were brought into the country illegally as children.

The decision by the San Francisco-based 9th U.S. Circuit Court of Appeals preserves the Deferred Action for Childhood Arrivals (DACA) program introduced in 2012 that has shielded from deportation a group of immigrants informally dubbed "Dreamers" and given them work permits, though not a path to citizenship.

The ruling represented another legal defeat for Trump over DACA, although he has won court victories on other parts of his hard-line immigration policies.

On Monday, his administration asked the U.S. Supreme Court to review a federal judge's January decision to block Trump from ending the program even before the 9th Circuit had weighed in, an unusually aggressive move in terms of procedure.

Trump said on Wednesday that he saw potential to work with Democrats, who won control of the House of Representatives this week, but that he would have to see how the Supreme Court ruled on the issue.

Trump has taken a stern stance against illegal immigration. His administration announced plans in September 2017 to phase out DACA, arguing that Obama had exceeded his constitutional powers when he bypassed Congress and created the program. DACA offers protections to roughly 700,000 young adults, mostly Hispanics, who entered the country as children.

San Francisco-based U.S. District Judge William Alsup decided in January that the government must continue processing renewals of existing DACA applications while litigation over the legality of Trump's action was being resolved.

The administration in February unsuccessfully appealed Alsup's ruling to the Supreme Court.