President Trump on Friday asserted he has the “legal right” to order Attorney General Bill Barr to do anything he wants in criminal cases handled by the Justice Department — a day after the nation’s top law enforcement officer criticized the commander-in-chief’s tweets.

“‘The President has never asked me to do anything in a criminal case.’ A.G. Barr,” the president said in a tweet, quoting what Barr told ABC News in an exclusive interview Thursday.

“This doesn’t mean that I do not have, as President, the legal right to do so, I do, but I have so far chosen not to!” Trump added.

In his rare rebuke of his boss, Barr said the president should stop tweeting about the Roger Stone case because his posts “make it impossible for me to do my job.”

“I think it’s time to stop the tweeting about Department of Justice criminal cases,” Barr said, adding that he has a problem “with some of the tweets.”

“As I said at my confirmation hearing, I think the essential role of the attorney general is to keep law enforcement, the criminal process sacrosanct to make sure there is no political interference in it. And I have done that and I will continue to do that,” he told the network’s chief justice correspondent, Pierre Thomas.

“And I’m happy to say that, in fact, the president has never asked me to do anything in a criminal case,” he said.

Barr added that he wouldn’t be pressured by anyone — even the president.

“I’m not going to be bullied or influenced by anybody … whether it’s Congress, a newspaper editorial board, or the president,” he said.

Trump this week thanked and praised Barr for overruling veteran prosecutors who had recommended that Stone — Trump’s longtime pal — serve between seven and nine years behind bars on his conviction for lying to Congress and other charges.

On Thursday, the White House said Trump “wasn’t bothered” by Barr’s criticism and that he still had “full faith” in the attorney general.