WASHINGTON — In an extraordinary rebuke of President Trump, Attorney General William P. Barr said on Thursday that Mr. Trump’s attacks on the Justice Department had made it “impossible for me to do my job” and asserted that “I’m not going to be bullied or influenced by anybody.”
Mr. Barr has been among the president’s most loyal allies and denigrated by Democrats as nothing more than his personal lawyer but publicly challenged Mr. Trump in a way that no other sitting cabinet member has.
“I’m not going to be bullied or influenced by anybody,” Mr. Barr said in an interview with ABC News. “And I said, whether it’s Congress, newspaper editorial board, or the president, I’m going to do what I think is right. I cannot do my job here at the department with a constant background commentary that undercuts me.”
Mr. Barr’s remarks were aimed at containing the fallout from the department’s botched handling of its sentencing recommendation for Mr. Trump’s longtime friend Roger J. Stone Jr., who was convicted of seven felonies in a bid to obstruct a congressional investigation that threatened the president.
Mr. Trump’s criticisms “make it impossible for me to do my job and to assure the courts and the prosecutors in the department that we’re doing our work with integrity,” Mr. Barr said.
He added, “It’s time to stop the tweeting about Department of Justice criminal cases.”
People close to the president said they were caught off guard by the interview.
Hours after prosecutors recommended on Monday that a judge sentence Mr. Stone to seven to nine years in prison, Mr. Trump attacked their request as “horrible and very unfair” and as a “miscarriage of justice.” The next day, Mr. Barr and other senior department officials intervened to lower the recommendation.
The episode ignited a firestorm among rank-and-file lawyers at the Justice Department. While the officials blamed the original filing on a miscommunication and said they had intended to correct it even before Mr. Trump assailed it, four of the prosecutors working on the case withdrew. Career prosecutors began to express worry that their work could be used to settle political scores.
Mr. Trump’s opponents escalated their accusations of inappropriate influence when he congratulated Mr. Barr for his decision to step in and ease the sentencing recommendation for Mr. Stone. “Congratulations to Attorney General Bill Barr for taking charge of a case that was totally out of control and perhaps should not have even been brought,” Mr. Trump said on Twitter.
The president also accused the prosecutors who had secured a conviction against Mr. Stone of engaging in an “illegal” investigation. He incorrectly accused Judge Amy Berman Jackson, who is presiding over the Stone trial, of placing his former campaign chairman, Paul Manafort, in solitary confinement. Mr. Manafort, who was convicted of monetary fraud in a case that grew out of the special counsel’s investigation, at one point had a jail cell to himself but was not in solitary confinement, and Judge Jackson was not involved in his placement.
And Mr. Trump compared the Stone case to the Russia investigation led by the special counsel, Robert S. Mueller III. “Even Bob Mueller lied to Congress,” Mr. Trump said, without evidence.
Mr. Trump reiterated his complaints on Thursday morning, claiming in a tweet that the Stone jury forewoman had “significant bias,” his first rhetorical assault on a juror. He was responding to a Fox News report that the forewoman was an anti-Trump Democratic activist.
Later, in a radio interview with Geraldo Rivera, he railed about the initial decision by Justice Department lawyers to recommend a seven- to nine-year sentence for Mr. Stone.
“What they did to Roger Stone was a disgrace in terms of everything, right from the beginning,” Mr. Trump said.
His complaints about the handling of Mr. Stone’s case have raised concerns from Democrats and critics that he was improperly influencing Justice Department matters.
Mr. Barr quickly became one of Mr. Trump’s trusted advisers after becoming attorney general last February — a reversal of the tense relationship that Mr. Trump had with Mr. Barr’s predecessor, Jeff Sessions.
Mr. Trump soured on Mr. Sessions after he recused himself from oversight of the Russia investigation. Their toxic relationship cast a political shadow over the department and strained dealings between the department and the White House.
Tensions eased when Mr. Barr arrived and embraced some of the most divisive aspects of Mr. Trump’s agenda, often serving as a polished and articulate defender of the president against accusations of abuse of power.
Michael D. Shear contributed reporting from Washington, and Maggie Haberman from New York.