President Donald Trump is lashing out at a judge's ruling blocking his attempt to strip funds from "sanctuary cities" that don't cooperate with U.S. immigration authorities, calling it "ridiculous" and vowing to take the case to the U.S. Supreme Court.
It was the third Trump executive order on immigration to be thwarted by the federal courts.
Here is a look at Tuesday's ruling and what lies ahead:
WHAT DID THE FEDERAL JUDGE SAY ABOUT THE SANCTUARY CITIES ORDER?
U.S. District Judge William Orrick in San Francisco said the president has no authority to attach new conditions of his own to spending that was approved by Congress.
The judge further ruled that Trump's order threatened a wide swath of funding — not the relatively small amount the Justice Department claimed — and that the government cannot cut off funding if there is no clear connection between the money and the policy at issue.
Attorney General Jeff Sessions said late Wednesday the president was well within his power to issue the executive order and the DOJ would continue to fight the cases in court. It was not clear, however, whether he planned to appeal Orrick's ruling.
WHAT COULD TRUMP DO NEXT?
If he wants to take his case to the Supreme Court, he will have to through the 9th U.S. Circuit Court of Appeals first. That was the court that blocked the president's first travel ban, against seven Muslim countries. Nearly 20 of the 25 active judges on the court were appointed by Democrats.
Trump could also revise his executive order to explicitly tie it to the three relatively modest Justice Department and Homeland Security grants that the administration argued were at stake.
Orrick said his ruling does not affect the administration's ability to enforce existing conditions on federal grants.
WHAT ELSE COULD THE ADMINISTRATION DO?
Trump could push Congress to pass a law giving him clear authority to revoke certain funding, said Margo Schlanger, a University of Michigan law professor and former head of civil rights at Homeland Security during the Obama administration.
But Schlanger said whatever action is taken may not survive court scrutiny if it's seen as unduly coercive.
"Suppose you said you can't have any money at all unless you participate fully in immigration arrests," she said. "That would be so big it would be coercive."
Additionally, for the law to survive, there must be a connection between the money at stake and the immigration policy the president is seeking to enforce, Schlanger said.
It is not clear how close that link has to be, but Trump presumably would not be allowed to withdraw funding for, say, highway construction to force a city to stop protecting immigrants from deportation.
WHAT OTHER CHALLENGES LIE AHEAD FOR THE SANCTUARY CITIES ORDER?
Orrick ruled on two cases brought by the city of San Francisco and California's Santa Clara County. Seattle and two cities in Massachusetts, Lawrence and Chelsea, have also sued.
WHAT WAS THE OBAMA ADMINISTRATION'S STAND ON FUNDING FOR SANCTUARY CITIES?
Last year, the Justice Department notified recipients of criminal justice grants that they must obey a federal law that says local governments cannot forbid their employees from cooperating with U.S. immigration authorities.
Recipients were reminded that that they could face penalties, such as the loss of grants, for not complying.
An inspector general's memo from last year said authorities were unaware of any legal action taken by the Obama administration to compel states or local governments to cooperate.