(Jenny Starrs/The Washington Post)

President Trump on Wednesday denounced as “ridiculous” a court ruling blocking his effort to withhold federal funds from cities and towns that refuse to cooperate with immigration authorities.

The decision Tuesday by a federal judge in San Francisco dealt another blow to the Trump administration even as it struggles to show progress on signature policies in its first 100 days.

It also brought another direct attack by the White House against a federal judge, whose ruling was derided in a White House statement as a “gift” to criminal gangs that puts “thousands of innocent lives at risk.”

In a series of tweets, Trump vowed that the White House was ready to bring the case to the Supreme Court and blasted the U.S. Court of Appeals for the 9th Circuit, which was part of legal decisions blocking Trump’s travel restrictions on several Muslim-majority countries.

“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 wrote.

(The Washington Post)

U.S. District Judge William H. Orrick — who imposed a temporary nationwide injunction against Trump’s Jan. 25 order — does not serve on the U.S. Court of Appeals for the 9th Circuit, though those judges would review his decisions.

In an earlier statement, the White House took aim at Orrick, saying his ruling “unilaterally rewrote immigration policy for our nation” and claiming it will give legal cover to underworld networks including sex traffickers and human smuggling operations.

“This case is yet one more example of egregious overreach by a single, unelected district judge,” the White House statement said.

The White House noted that San Francisco, where Orrick has been on the federal bench since 2013, was “the same sanctuary city” where a local woman, Kate Steinle, was killed in 2015 by a gunshot allegedly fired by an undocumented Mexican man who had been deported five times.

“San Francisco, and cities like it, are putting the well-being of criminal aliens before the safety of our citizens, and those city officials who authored these policies have the blood of dead Americans on their hands,” said the White House statement issued late Tuesday.

In his decision, Orrick pointed to discrepancies in the administration’s interpretation of the executive order, which broadly authorized the attorney general to withhold grant money from jurisdictions that do not cooperate with immigration officials on deportations and other enforcement actions.

Lordes Reboyoso carries a placard at a rally supporting sanctuary cities outside City Hall in San Francisco in January. (Jeff Chiu/AP)

At the same time, the judge said the Justice Department may hold back grant money that is awarded with immigration-related conditions, if those conditions are violated. The department responded to the ruling by saying it could essentially continue to operate as it had been.

The judge’s decision largely blocks the administration from doing things its lawyers said in court the agency would not do, such as strip health-care funding from cities and towns.

But the American Civil Liberties Union and other advocacy groups said the injunction offered a clear warning that Trump’s order — the third issued by the president to be blocked, at least partially, in federal court — is illegal.

“Once again, the courts have spoken to defend tolerance, diversity and inclusion from the illegal threats of the Trump administration,” ACLU National Political Director Faiz Shakir said in a statement. “Once again, Trump has overreached and lost.”

In court, the government’s lawyers suggested cities and towns were overreacting to the order because federal officials have not yet defined sanctuary cities or moved to withhold funding from them. But on television and in news conferences, the judge pointed out, the president and Attorney General Jeff Sessions have threatened to sanction such jurisdictions.

“The result of this schizophrenic approach to the Order is that the Counties’ worst fears are not allayed and the Counties reasonably fear enforcement under the Order,” the judge wrote. “The threat of the Order and the uncertainty it is causing impermissibly interferes with the Counties’ ability to operate, to provide key services, to plan for the future, and to budget.”

Trump says sanctuary cities put Americans at risk by refusing to hold immigrants who have been arrested or convicted of serious crimes until immigration agents can take them into custody and deport them.

Sanctuary cities’ officials counter that they do not have the legal authority to hold a person after a judge in a criminal case has ordered that person released. Holding people on immigration offenses is generally a civil process, rather than a criminal one.

White House Chief of Staff Reince Priebus said Justice Department lawyers are reviewing legal options. “It’s the 9th Circuit going bananas,” he told reporters Tuesday evening. “The idea that an agency can’t put in some reasonable restriction on how some of these monies are spent is going to be overturned eventually, and we’ll win at the Supreme Court level at some point.”