A San Francisco leftist who gave big bucks to Democrats endangers national security.

An Obama judge in San Francisco issued a nonsensical, lawless order May 24 temporarily stopping President Trump from accessing reallocated military funding to pay for the construction of a desperately needed wall on the nation’s leaky southern border.

The case will almost certainly end up before the Supreme Court in the future.

U.S. District Judge Haywood S. Gilliam Jr., appointed by then-President Barack Hussein Obama in 2014, enjoined the Trump administration “from taking any action to construct a border barrier” with reassigned U.S. Department of Defense funds in parts of Arizona and Texas known as Yuma Sector Project 1 and El Paso Sector Project 1.

During the confirmation process before the U.S. Senate, Gilliam insisted that judges should be impartial.

“I believe that the most important attribute of a judge is the commitment to faithfully and impartially apply the law in every case, without regard to the type of matter or the identity of the parties,” he said.

The leftist judge reportedly made large donations to Democrats from 2007 to the end of 2014 when he was sworn in as a judge.

Gilliam gave $6,900 to the presidential campaign of the man who appointed him, divided between $4,600 to Obama for America and $2,300 to the Obama Victory Fund. The judge also donated a separate $13,500 to Obama for America and Obama Victory Fund 2012, along with $4,500 to the Democratic National Committee.

In the preliminary injunction Gilliam wrote that “irreparable harm” would result if the Trump administration were to move forward with construction while the lawsuit brought by the leftists at the Sierra Club awaited trial.

“Because the Court has found that Plaintiffs are likely to show that Defendants’ actions exceeded their statutory authority, and that irreparable harm will result from those actions, a preliminary injunction must issue pending a resolution of the merits of the case,” he wrote.

Gilliam also falsely accused President Trump of violating the separation of powers doctrine and interfering with Congress’s power of the purse.

“The position that when Congress declines the Executive’s request to appropriate funds, the Executive nonetheless may simply find a way to spend those funds ‘without Congress’ does not square with fundamental separation of powers principles dating back to the earliest days of our Republic,” he wrote.

Except that’s not quite what happened.

Yes, Congress declined to fork over all the money Trump asked for to build a border barrier.

But on Feb. 15 of this year as lawmakers withheld their approval for the bulk of the requested spending, President Trump invoked his lawful powers under the National Emergencies Act of 1976, a statute approved by a previous Congress that gave presidents the power to declare limited emergencies.

Writing in The Hill newspaper recently about Trump’s invocation of the statute, left-leaning constitutional law professor Jonathan Turley said, “Congress expressly gave presidents the authority to declare such emergencies and act unilaterally.”

The law had been used repeatedly by every president since Gerald Ford with little fanfare until the current president cited it. Lawmakers have failed to overturn Trump’s use of the law to secure border wall construction funding.

Trump called upon the statute in mid-February as Congress gave final approval to a $333 billion omnibus spending bill. The legislation allocates $1.375 billion for 55 miles of border barriers in Texas, well below the $5.7 billion Trump sought for a border wall and the $25 billion he originally said he wanted. The emergency declaration shifted about $6.7 billion that was previously designated for other projects, largely for military construction.

Gilliam’s injunction ought to worry those concerned about the rule of law.

The nationwide injunction is part of a trend Attorney General William Barr calls dangerous because it allows an individual federal judge to, in effect, veto presidential decisions.

Such injunctions give “a single judge the unprecedented power to render irrelevant the decisions of every other jurisdiction in the country.”

In other words, he said, “one judge in one circuit gets to control the law until the Supreme Court intervenes.”

According to the Justice Department, an average of 1.5 such national or universal injunctions were issued each year against the administrations of Ronald Reagan, Bill Clinton, and George W. Bush. Under Barack Obama, the average rose to 2.5.

But 37 injunctions have been issued against the Trump administration since the president was inaugurated, according to Barr.

The anti-wall litigation continues.