WASHINGTON (Reuters) - President Donald Trump on Wednesday attacked a federal judge’s ruling that blocked his executive order seeking to withhold funds from “sanctuary cities” for illegal immigrants, vowing to appeal it to the U.S. Supreme Court.

People participate in a protest against President Donald Trump's travel ban, in New York City, U.S. January 29, 2017. REUTERS/Stephanie Keith

Tuesday’s ruling by U.S. District Judge William Orrick in San Francisco was the latest blow to Trump’s efforts to toughen immigration enforcement. Federal courts have also blocked his two travel bans on citizens of mostly Muslim nations.

“First the Ninth Circuit rules against the ban & now it hits again on sanctuary cities-both ridiculous rulings. See you in the Supreme Court!” Trump said in a tweet on Wednesday, referring to the San Francisco-based federal appeals court and its judicial district.

The Trump administration has targeted sanctuary cities, which generally offer safe harbor to illegal immigrants and often do not use municipal funds or resources to advance the enforcement of federal immigration laws.

Later on Wednesday, Trump, asked in an interview with the Washington Examiner if he had considered proposals to break up the 9th Circuit Court, said: “Absolutely, I have.”

“There are many people that want to break up the 9th Circuit. It’s outrageous,” he told the newspaper.

The latest ruling did not come from the 9th U.S. Circuit Court of Appeals to which Trump was referring. It came from the federal district court in San Francisco.

Critics have said local authorities endanger public safety when they decline to hand over for deportation illegal immigrants arrested for crimes, while supporters argue that enlisting police cooperation to round up immigrants for removal undermines trust in local police, particularly among Latinos.

Dozens of local governments and cities, including New York, Los Angeles and Chicago, have joined the “sanctuary” movement.

In his ruling, Orrick said Trump’s Jan. 25 order targeted broad categories of federal funding for the sanctuary cities and that plaintiffs challenging it were likely to succeed in proving it unconstitutional.

‘WILL CONTINUE TO LITIGATE’

U.S. Attorney General Jeff Sessions blasted Orrick’s ruling, saying Trump’s executive order was “squarely within the powers of the President.”

“The Department of Justice cannot accept such a result, and as the President has made clear, we will continue to litigate this case to vindicate the rule of law,” Sessions said in a statement.

An appeal is likely to be heard by the 9th Circuit before it goes to the Supreme Court. Republicans view the appeals court as biased toward liberals, and Trump was quick to attack its reputation in his tweets.

It “has a terrible record of being overturned (close to 80%). They used to call this “judge shopping!” Messy system,” Trump said.

The appeals court raised Trump’s ire earlier this year when it upheld a Seattle judge’s decision to block the Republican president’s first travel ban on citizens of seven predominantly Muslim nations.

In May, the 9th Circuit will hear an appeal of a Hawaii judge’s order blocking Trump’s revised travel ban, which placed restrictions on citizens from six mostly Muslim countries. A Maryland judge also blocked portions of the second ban.

Trump has issued sweeping condemnations of courts and judges when they have ruled against him or his administration.

In February, he called the federal judge in Seattle who ruled against his first travel ban a “so-called judge.” During the 2016 presidential campaign, Trump accused an Indiana-born judge overseeing lawsuits against the defunct Trump University of bias based on his Mexican ancestry.