Showing no trust in an independent judiciary, U.S. President Donald Trump is using a federal appeals court in San Francisco as a punching bag for his frustrations about not getting his way on border security.

But according to many experts, he's spreading misinformation in the process and appears to misunderstand how appeals work.

On Monday, U.S. District Judge Jon Tigar, who had been nominated by Democratic President Barack Obama, temporarily barred the Trump administration from refusing asylum to immigrants who cross the southern border illegally. Any appeal is likely to go to the 9th Circuit court.

"Whatever the scope of the President's authority, he may not rewrite the immigration laws to impose a condition that Congress has expressly forbidden," wrote Tigar in his ruling.

The president assailed the judge who rejected his migrant asylum policy as an "Obama judge," drawing a rare rebuke from Chief Justice John Roberts.

"We do not have Obama judges or Trump judges, Bush judges or Clinton judges," Roberts said, hailing the fact the U.S. is supposed to have an independent judiciary.

Trump was unmoved, arguing on Twitter on Thursday: "Justice Roberts can say what he wants, but the 9th Circuit is a complete & total disaster. It is out of control, has a horrible reputation, is overturned more than any Circuit in the Country, 79%, & is used to get an almost guaranteed result."

Trump, as a political figure, has had a habit of branding judges as biased, dating back to the campaign trail.

He berated District Judge Gonzalo Curiel in 2016 for his handling of fraud allegations against the now-defunct Trump University, suggesting to the Wall Street Journal that Curiel's Mexican heritage reflected a bias given Trump's well-known views on a border wall.

"He is a member of a club or society, very strongly pro-Mexican," Trump said in a subsequent interview with CBS News.

The number of reversals, examined

Trump's description in an earlier tweet of the "shocking" number of overturned cases in the 9th Circuit belies the nature of the appeals system. He was factually wrong in declaring that rulings by the 9th U.S. Circuit Court of Appeals by the Supreme Court are more frequently reversed than those of any other federal appeals court.

Stephen Vladeck, a professor at the University of Texas School of Law, said on Twitter that at the most basic level, Trump didn't even direct his ire at the right court.

1. Let's start with the easiest and most obvious flaw: The actual decision that has set off this tirade was by a federal district judge in San Francisco, _not_ the Ninth Circuit. Especially if he's relying on reversal rates (more on that shortly), that's a pretty key distinction. —@steve_vladeck

It repeats almost exactly the same erroneous accusation Trump made in April 2017, when he blamed the 9th Circuit for an unfavourable ruling on withholding funding to so-called sanctuary cities, when in fact it had been made by a federal district court.

As far as the numbers are concerned, over the past five years, the Supreme Court overturned a greater percentage of rulings from the 3rd Circuit (92.3 per cent), the 6th Circuit (85.1 per cent) and the Atlanta-based 11th Circuit (81.8 per cent) than from the 9th (77.4 per cent), according to The Associated Press's analysis of statistics from the legal website Scotusblog.

The 9th is by far the largest of the 13 federal courts of appeals, covering Alaska, Arizona, California, Hawaii, Idaho, Montana, Nevada, Oregon and Washington. That means that in raw numbers, more cases are heard and reversed from the 9th year in and year out. But that does not make it the most frequently overturned.

George Conway, who has argued cases before the Supreme Court and is a frequent Trump critic — even as his wife, Kellyanne Conway, serves as a key White House spokesperson — called Trump's tweets "misleading."

Anyway, to put the point more simply, the Supreme Court doesn’t usually take cases to affirm them, which is why the statistic the President is citing is misleading. —@gtconway3d

The top court generally only takes on the thorniest cases, Conway pointed out on social media.

In the last term, the Supreme Court overturned 100 per cent of the decisions of the 1st Circuit in Boston, the 3rd Circuit in Philadelphia and the 6th Circuit in Cincinnati. For the 9th Circuit, 86 per cent were overturned.

Overall, the Supreme Court overturned decisions about two-thirds of the time.

Judges are not self-selecting

Trump raised questions this week whether the 9th Circuit was an "independent judiciary," and has accused liberals and critics of his administration of "judge shopping" to get favourable rulings.

It's not unusual for those challenging a president's policies to sue in courts they consider likely to back their claims, and it's true that the 9th Circuit is a liberal-leaning court. But conservative groups tended to bring challenges to Barack Obama-era policies in Texas, part of the conservative-leaning 5th U.S. Circuit Court of Appeals in New Orleans.

U.S. District Judge Gonzalo Curiel was nominated by former president Barack Obama, and has handled two cases Trump has had a vested interest in. (United States District Court, Southern District of California)

In the aforementioned sanctuary cities case, the two local governments that sued to block Trump's order, San Francisco and Santa Clara County, are in California, and therefore routinely file in the court in their neighbourhood.

Judges are then assigned through a system that resembles a lottery.

The 9th Circuit has 16 judges appointed by Democratic presidents, seven by Republicans and six vacancies. Trump has nominated candidates for five of the openings.

He is likely to tilt the ideological balance of that court, as well as others.

But he can't count on them being "Trump judges."

It was Roberts, a nominee of Republican George W. Bush, who was the decisive Supreme Court vote preserving Obama's health care overhaul.

It was U.S. District Judge Timothy Kelly who granted a temporary restraining order restoring access to the White House for CNN reporter Jim Acosta, after the administration had pulled his credential.

Kelly was put on the bench by Trump, as was Dabney Friedrich in D.C., who in a ruling this August upheld the authority of special counsel Robert Mueller.

"This is not about judges 'refusing to follow the Constitution,' or substituting their own policy preferences for those of the political branches," Vladeck argued on Twitter, in specific reference to the asylum ruling. "Rather, it's about a federal judge holding that an Executive Order violates the plain language of a clear, unambiguous statute."

3. So this is not about judges "refusing to follow the Constitution," or substituting their own policy preferences for those of the political branches. Rather, it's about a federal judge holding that an Executive Order violates the plain language of a clear, unambiguous statute. —@steve_vladeck

According to a Slate article this week citing tracking of cases by the think-tank Brookings, those defeats are happening more frequently to the Trump administration than recent predecessors. The administration is also seemingly abandoning cases at a higher rate once an unfavourable ruling comes down, choosing to go back to the drawing board with attempts at new policy rather than through court appeals.

The administration has been blocked, for example, on issues relating to transgender people in the military, so-called Dreamer children of those who crossed into the U.S. illegally and attempts to indefinitely separate children from parents who cross between ports of entry.

Two versions of Trump's so-called travel ban were rejected by the courts before the Supreme Court upheld the third attempt 5-4 on party lines, saying it was within Trump's constitutional authority, but not ruling on the merits of the ban itself.

One of the Trump administration's wins occurred earlier this year when a court rejected arguments by the state of California and advocacy groups that the administration overreached by waiving laws requiring environmental and other reviews before construction can begin on a Mexican border wall.

"Big legal win today," Trump tweeted in response to the ruling.

The judge who made the ruling?

Gonzalo Curiel, the one and the same "Mexican judge" nominated by Obama.