WASHINGTON — President Donald Trump and Chief Justice John Roberts clashed Wednesday in an extraordinary public dispute over the independence of America’s judiciary, with Roberts bluntly rebuking the president for denouncing a judge who rejected his migrant asylum policy as an “Obama judge.”

There’s no such thing, Roberts declared in a strongly worded statement contradicting Trump and defending judicial independence. Never silent for long, Trump defended his own comment, tweeting defiantly, “Sorry Justice Roberts.”

The pre-Thanksgiving dustup was the first time that Roberts, the Republican-appointed leader of the federal judiciary, has offered even a hint of criticism of Trump, who has several times blasted federal judges who have ruled against him.

Before now, it has been highly unusual for a president to single out judges for personal criticism. And a chief justice’s challenge to a president’s comments is downright unprecedented in modern times.

It seemed a fight that Trump would relish but one that Roberts has taken pains to avoid. But with Roberts’ court feeling the heat over the president’s appointment of Justice Brett Kavanaugh, Roberts and several of his colleagues have gone out of their way to rebut perceptions of the court as a political institution divided between five conservative Republicans and four liberal Democrats.

Trump’s appointments to the Supreme Court and lower federal courts have themselves spurred charges that the courts are becoming more politicized. As the justice widely seen as closest to the court’s middle, Roberts could determine the outcome of high-profile cases that split the court.

The new drama began with remarks Trump made Tuesday in which went after a judge who ruled against his migrant asylum order. The president claimed, not for the first time, that the federal appeals court based in San Francisco was biased against him.

Roberts had refused to comment on Trump’s earlier attacks on judges, including the chief justice himself. But on Wednesday, after a query by The Associated Press, he spoke up for the independence of the federal judiciary and rejected the notion that judges are loyal to the presidents who appoint them.

“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,” Roberts said.

On the day before Thanksgiving, he concluded, “The independent judiciary is something we should all be thankful for.”

Trump hit back from his resort home in Florida, questioning the independence of federal judges appointed by his predecessor and confirmed by the U.S. Senate. He especially criticized judges on California’s 9th U.S. Circuit Court of Appeals.

“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,” the president tweeted.

If the 9th Circuit judges are independent, he said, “why are so many opposing view (on Border and Safety) cases filed there, and why are a vast number of those cases overturned. … these rulings are making our country unsafe! Very dangerous and unwise!”

Trump has never been reticent about criticizing the judiciary. Last year, the president scorned the “so-called judge” who made the first federal ruling against his travel ban. During the presidential campaign, he criticized Roberts himself for the chief justice’s decisive vote in 2012 to preserve President Barack Obama’s health care overhaul.

Trump also referred to an Indiana-born judge of Mexican descent, who was presiding over a fraud lawsuit against Trump University, as a Mexican who would be unable to rule fairly because of Trump’s proposal to build a wall along the U.S.-Mexican border.

The president’s remarks on Tuesday came when a reporter asked for his reaction to a ruling by U.S. District Judge Jon Tigar in San Francisco that put the administration’s asylum policy on hold. Under that new policy, Trump declared no one could apply for asylum except at an official border entry point. That tends to back migrants up for weeks if not months. A number of migrants remain in Tijuana after traveling in a caravan to reach the U.S.

Trump complained that his opponents file lawsuits in courts that are part of California’s liberal-leaning 9th Circuit. It’s not unusual for those challenging a president’s policies to sue in courts they consider likely to back their claims. Conservative groups tended to bring challenges to Obama-era policies in Texas, part of the conservative-leaning 5th U.S. Circuit Court of Appeals in New Orleans.

“Every case that gets filed in the 9th Circuit, we get beaten. And then we end up having to go to the Supreme Court, like the travel ban, and we won,” Trump said.

The president went on to say about the asylum ruling: “This was an Obama judge. And I’ll tell you what, it’s not going to happen like this anymore. ”

The initial travel ban ruling in 2017 was issued by U.S. District Judge James Robart, an appointee of President George W. Bush in Washington state. Roberts, too, was appointed by Bush.

It was unclear what Trump meant when he said things would change. The 9th Circuit is by far the largest of the federal appellate courts, covering Alaska, Arizona, California, Hawaii, Idaho, Montana, Nevada, Oregon and Washington. Some Republicans in 9th Circuit states have proposed splitting the circuit in two, but legislation has not advanced.

The court has long had a majority of judges appointed by Democratic presidents, with the current breakdown at 16-7. But Trump has the opportunity to narrow that edge significantly because there are six vacancies, and he already has nominated candidates for five of them.

RELATED: Judge bars US from enforcing Trump asylum ban