ANALYSIS/OPINION:

Americans have always taken a certain pride in the fact, heretofore honored, that the United States is a nation of laws. Now America is more accurately “sometimes a nation of laws” — you can just observe the laws you like. Even federal judges sometimes take this approach.

U.S. District Judge William H. Orrick III of San Francisco last week stayed President Trump’s executive order to withhold certain federal money from so-called “sanctuary” towns and cities that provide safe harbor for illegal immigrants posing as immigrants.

If words written in plain and simple English mean anything, Judge Orrick’s order violates the language of U.S. Code Title 8, Section 1373, which was signed into law in September 1996 by President Bill Clinton, a Democrat. That law says in part that “a federal, state, or local government entity or official may not prohibit, or in any way restrict, any government entity or official from sending to, or receiving from, the Immigration and Naturalization Service information regarding the citizenship or immigration status, lawful or unlawful, of any individual.”

Mr. Trump’s Jan. 25 executive order stated that the attorney general of the United States and the U.S. secretary of Homeland Security “in their discretion and to the extent consistent with law shall ensure that jurisdictions that willfully refuse to comply with [Title] 8 U.S.C. 1373 (sanctuary jurisdictions) are not eligible to receive Federal grants.”

Judge Orrick was appointed by Barack Obama, like the federal judges in Hawaii and Maryland who in March stayed Mr. Trump’s temporary bans on travel to the United States from several Middle Eastern nations with a record of exporting violent law-breaking citizens to other countries. The ruling of Judge Orrick and the others is now on appeal to higher courts.

Judge Orrick enjoined targeting broad categories of federal funding for sanctuary scofflaw governments, in the case at hand, San Francisco and Santa Clara County, California. The judge ruled that the president overstepped his authority, and that only Congress could impose conditions on federal spending.

The same liberal Democrats — “progressives,” as they’re calling themselves this season — who cheered Judge Orrick’s reasoning curtailing Mr. Trump’s authority to cut off federal funds to achieve “political ends” sang from a different page when Mr. Obama threatened to cut off federal grants to North Carolina and other states unless they complied with his edict to open the doors of public toilets to all comers, male and female together, to accommodate the wishes of the gender-confused.

Judge Orrick’s background reflects political activism, hardly legal scholarship. Judge Orrick, together with his missus, raised more than $200,000 for Mr. Obama’s 2008 presidential campaign and donated $30,800 to political action committees supporting him, according to Public Citizen, a liberal consumer-advocacy group that tracks political campaign contributions. Four years before that, the Orricks “bundled” $100,000 for John Kerry’s failed presidential campaign.

The U.S. Senate, then organized by Democrats, confirmed Mr. Orrick as a federal judge by a vote of 56 to 41, with three Republicans — Lisa Murkowski of Alaska, Jeff Flake of Arizona and Susan Collins of Maine — voting with the Democrats. Not a single Democrat considered Mr. Orrick’s bundling and activism as disqualifying him from the federal bench.

President Trump rightly called Judge Orrick’s ruling a result of “judge shopping.” “Once again,” the White House said after the Orrick ruling, “a single district judge, this time in San Francisco, has ignored federal immigration law to set a new immigration policy for the entire country.”

President Trump must accelerate efforts to fill federal court vacancies with men and women who will interpret the law as written, and not impose their own preferences, as many of Mr. Obama’s judges do. There are currently 129 vacancies on district and appeals courts awaiting nominees. That represents about 15 percent of the entire federal judiciary, and there’s just a single nomination pending before the Senate Judiciary Committee.

Sen. Chuck Schumer’s slash-and-burn strategy to destroy the Trump presidency has stalled the confirmation of many Trump appointments, and the president must be prepared to fill many, perhaps most, of these vacancies with recess appointments. Elections have consequences, as the Democrats don’t seem to understand. Denouncing the work of rogue judges is well and good, but President Trump must do better than that by staffing the federal judiciary with lawyers who understand and honor what “a nation of laws” actually means.