Attorney General William P. Barr delivered a sharp reproach on Thursday to President Trump, defending the role of the Justice Department in the face of the president’s persistent attacks.

In an interview with ABC News, Mr. Barr addressed the fallout this week over a case involving a longtime friend of Mr. Trump’s, Roger J. Stone Jr., who was convicted last year of obstructing a congressional inquiry. His comments amounted to a rare rebuttal by a cabinet official who has almost unflinchingly stood by the president through politically sensitive investigations and the impeachment inquiry.

Mr. Barr said Mr. Trump’s disparaging remarks over sentencing recommendations for Mr. Stone undermined the Justice Department and made it “impossible for me to do my job.” Senior department officials, including Mr. Barr, intervened this week to recommend a more lenient sentence, and Mr. Trump spent days afterward criticizing the department and the prosecutors and the judge overseeing Mr. Stone’s case.

Here are some of the key quotes from Mr. Barr’s interview:

On the president’s tweets regarding Stone’s sentencing

“To have public statements and tweets made about the department — about people in the department, our men and women here, about cases pending in the department 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 in the department that we’re doing our work with integrity.”