The US chief justice has rebuked Donald Trump for calling a judge who ruled against his migrant asylum policy an "Obama judge".
In a statement released by the Supreme Court, Chief Justice John Roberts said: "We do not have Obama judges or Trump judges, Bush judges or Clinton judges.
"What we have is an extraordinary group of dedicated judges doing their level best to do equal right to those appearing before them. That independent judiciary is something we should all be thankful for."
Justice Roberts was defending US district judge Jon Tigar in San Francisco, whose ruling put the administration's asylum policy on hold.
Under the new policy – which comes as a caravan of central American migrants travels towards the US – no one can apply for asylum except at an official border entry point.
"This was an Obama judge. And I'll tell you what, it's not going to happen like this anymore," said Mr Trump of Judge Tigar's ruling.
Judge Tigar was nominated by former president Barack Obama in 2012.
After Justice Roberts responded in his defence, Mr Trump replied on Twitter: "Sorry Chief Justice John Roberts, but you do indeed have 'Obama judges' and they have a much different point of view than the people who are charged with the safety of our country. It would be great if the 9th Circuit was indeed an 'independent judiciary', but if it is why……
"…..are so many opposing view (on border and safety) cases filed there, and why are a vast number of those cases overturned. Please study the numbers, they are shocking. We need protection and security – these rulings are making our country unsafe! Very dangerous and unwise!
"A terrible, costly and dangerous disgrace. It has become a dumping ground for certain lawyers looking for easy wins and delays. Much talk over dividing up the 9th Circuit into 2 or 3 Circuits. Too big!"
And on Thursday, the president tweeted: "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. Judges must not Legislate Security."
The 9th Circuit covers Alaska, Arizona, California, Hawaii, Idaho, Montana, Nevada, Oregon and Washington.
The court has long had a majority of judges appointed by Democratic presidents, with the current breakdown at 16-7.
However, Mr Trump has the opportunity to narrow that edge significantly because there are six vacancies, and he has already nominated candidates for five of them.
It is the first time Justice Roberts, the leader of the US judiciary and a conservative who was appointed by Republican former president George W Bush, has criticised Mr Trump.
More from Donald Trump
However, in the aftermath of the president's appointment of Justice Brett Kavanaugh to the Supreme Court, several justices have spoken out to rebut perceptions of the court as a political institution divided between five conservative Republicans and four liberal Democrats.
Justice Roberts is widely seen as closest to the court's middle and likely to determine the outcome of high-profile cases that split the court.