The Justice Department on Friday revealed that it would not charge former acting FBI director Andrew McCabe, a longtime target of President Trump’s wrath, exacerbating the angry divide between Trump, his attorney general and federal law enforcement officials.

The development came just a day after Attorney General William P. Barr made a televised entreaty to Trump to stop tweeting about criminal cases — and just hours after Trump defied that request.

While three White House officials said Barr, one of Trump’s most loyal and effective Cabinet secretaries, was in no immediate danger of being fired, the attorney general’s relationship with the president is facing its gravest threat yet. Inside and outside the Justice Department, officials watched warily — some questioning whether Barr was truly at odds with Trump, others heartened by what seemed to be Barr defending the institution’s historical independence and all wondering what comes next.

The eventful day began — as many in Washington do now — with a defiant Trump reacting on Twitter to something he saw on television. The president quoted from Barr’s interview Thursday with ABC News, during which the attorney general asserted that Trump had never asked him to do anything related to a criminal case.

“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 own voice.

A Justice Department spokeswoman declined to comment on Trump’s tweet.

Hours later, the department made a move that might be seen as exerting its independence, revealing that it would not charge McCabe with lying to investigators about a media disclosure years ago.

Officials familiar with the matter, who like others spoke on the condition of anonymity to discuss Trump’s interactions, said the president was not told about the McCabe decision in advance and was upset. White House lawyers, including White House counsel Pat Cipollone, moved to calm the president, these people said. One official said Trump “believes very strongly that action should be taken.”

Trump, who is spending the weekend at his Mar-a-Lago Club in South Florida, did not address Barr’s TV interview or the McCabe case in a speech before departing the White House. He and Barr spoke Friday afternoon, but the substance of their discussion was not immediately clear, a person familiar with the matter said. White House aides are counseling Trump not to discuss McCabe at all, according to those familiar with the matter.

Democratic lawmakers and legal analysts, meanwhile, remained wary of what Barr was up to, and another development Friday indicated he was far from a complete break with the president.

According to people familiar with the matter, Barr has tasked outside prosecutors — in the deputy attorney general’s office and from the U.S. attorney’s office in St. Louis — to review the handling of the criminal case against former Trump national security adviser Michael Flynn and other sensitive national security and public corruption prosecutions in the U.S. attorney’s office in Washington. Among the other cases are the investigation into Blackwater founder Erik Prince for potentially lying to Congress, along with other matters that have not yet been made public, a person familiar with the matter said.

The prosecutors began their work in recent weeks, coinciding with the transition of office leadership from former U.S. Attorney Jessie K. Liu to interim U.S. attorney Timothy J. Shea, a former Barr counselor. One Justice Department official said a prosecutor with the St. Louis U.S. attorney’s office is working with Flynn prosecutor Brandon Van Grack, characterizing his work as “assisting” Van Grack in a review of the case.

That has fueled concerns among career prosecutors and others that the department’s political leadership is making a push to exert more control at a key point in sensitive, high-profile cases. Flynn was one of the early people to plead guilty in connection with special counsel Robert S. Mueller III’s probe, admitting he lied to the FBI about his contacts with the Russian ambassador to the United States, though he has since tried to withdraw his plea and allege misconduct on behalf of prosecutors.

The review was first reported by the New York Times.

Trump has consistently sought to undermine Mueller’s probe and those involved in it — either by asking for investigations of the investigators or, in more extreme cases, that criminal charges be filed against them. That has been particularly true for McCabe and his former boss, James B. Comey.

“Of all of them, it’s Comey and McCabe that seem to really rile him up,” one person close to Trump and Barr said of the president.

Behind the scenes, Trump has raged over the lack of legal action against the pair, including last August — when officials announced that Comey would not face charges for his handling of memos he wrote while FBI director — and in January, when The Washington Post reported that a re-examination of corruption allegations related to Hillary Clinton had come up empty, according to people familiar with the discussions.

As a top law enforcement official, McCabe authorized the FBI to begin investigating Trump personally for possible obstruction of justice in connection with the probe into whether the Trump campaign coordinated with Russia to influence the 2016 election.

McCabe became the focus of a grand jury probe over allegations from the Justice Department inspector general that he lied to investigators exploring a media disclosure. Department officials authorized prosecutors to seek an indictment of him last year, and in September a grand jury that had been hearing evidence was summoned back to consider the case after a months-long hiatus.

But the day came and went with no public charges being filed. ­McCabe’s legal team sought to press the Justice Department for a status update but was told nothing. A spokeswoman for the D.C. U.S. attorney’s office, which led the investigation, declined to comment.

McCabe, a CNN contributor, said on the network Friday that the investigation was a “horrific black cloud that’s been hanging over me and my family for almost the last two years” and that the formal end of it was a “relief” he could not put into words.

“It’s just a very emotional moment for my whole family,” he said.

Trump’s attacks made a prosecution of McCabe especially complicated. According to materials made public Friday in a Freedom of Information Act case related to the investigation, a federal judge in D.C. warned prosecutors in the case that the public was watching and that comments from the White House were detrimental.

“I just think it’s a banana republic when we go down that road and we have those type of statements being made that are conceivably, even if not, influencing the ultimate decision,” Judge Reggie B. Walton said. “I think there are a lot of people on the outside who perceive that there is undue,inappropriate pressure being brought to bear.”

He added later, “I think as a government and as a society we’re going to pay a price at some point for this.”

Barr, too, had for weeks been concerned with Trump’s tweets about criminal cases, and on Thursday he decided to make his feelings known publicly.

“I think it’s time to stop the tweeting about Department of Justice criminal cases,” he told ABC News, adding that such statements “about the department, about people in the department, our men and women here, about cases pending here, and about judges before whom we have cases, make it impossible for me to do my job and to assure the courts and the prosecutors and the department that we’re doing our work with integrity.”

Justice Department staff informed the White House about Barr’s ABC interview after it was recorded, but before it aired, a person familiar with the matter said. They did not provide specifics, the person said. In recent weeks, Barr had told Trump privately more than once that the president’s tweets and public statements were creating difficulties for the Justice Department, but when those private talks seemed not to have the desired effect, the attorney general decided to raise the issue publicly, according to people familiar with the matter.

Barr also said in the interview Thursday that Trump would be within his rights to ask for a criminal investigation in an area that didn’t affect his personal interest — such as in a terrorism case or fraud by a bank. But he said an attorney general would not listen to an order to investigate a political opponent.

“If he were to say go investigate somebody, and you sense it’s because they’re a political opponent, then an attorney general shouldn’t carry that out, wouldn’t carry that out,” Barr said.

The public rebuke of the president by a sitting member of his Cabinet arose from a crisis of confidence at the Justice Department, which had been accused this week of buckling to an angry tweet the president issued after he learned of prosecutors’ initial prison recommendation for his longtime friend Roger Stone.

A federal jury convicted Stone in November on charges of witness tampering and lying to Congress about his efforts to gather damaging information about Clinton, Trump’s 2016 presidential election opponent.

On Tuesday, Trump criticized as unduly harsh the initial sentencing recommendation of seven to nine years made by front-line prosecutors. Shortly thereafter, the Justice Department signaled that it would seek a more lenient sentence for Stone, a move that prompted the four career prosecutors to withdraw from the case — and one to resign from the government.

Barr has said the decision was made before Trump’s tweet on the matter. His assertions, though, have not fully placated legal analysts and Democrats on Capitol Hill concerned that he is not adequately protecting the Justice Department’s independence. Rep. Adam B. Schiff (D-Calif.) asserted Friday on Twitter that Barr had admitted intervening in a case “to cover up for the President.”

“He’s only upset that Trump’s tweets made the political nature of his intervention obvious,” Schiff wrote. “Barr fools no one. He’s a witting accomplice to Trump’s attack on the rule of law.”

Stone is scheduled to be sentenced next Thursday, though on Friday his defense attorneys demanded a new trial. The request came one day after Trump said on Twitter that the forewoman of the jury that convicted him “had significant bias”

John Wagner and Karoun Demirjian contributed to this report.