WASHINGTON — William P. Barr, President Trump’s nominee for attorney general, assured senators at his confirmation hearing on Tuesday that he will permit the special counsel, Robert S. Mueller III, to complete the Russia investigation and said he was determined to resist any pressure from President Trump to use law enforcement for political purposes.
Mr. Barr, whose confirmation seems virtually assured, pointed to his age and background — he also served as attorney general from 1991 to 1993 — as buffers to potential intrusions on the Justice Department’s traditional independence. He suggested he had no further political aspirations that might cloud his judgment, the way that future ambitions might give pause to a younger nominee, as well as the experience to fight political interference.
“I am in a position in life where I can provide the leadership necessary to protect the independence and reputation of the department,” Mr. Barr, 68, told the Senate Judiciary Committee, adding that he would not hesitate to resign if Mr. Trump pushed him to act improperly.
“I will not be bullied into doing anything I think is wrong — by anybody, whether it be editorial boards or Congress or the president,” Mr. Barr said. “I’m going to do what I think is right.”
He also pledged that he would refuse any order from Mr. Trump either to fire Mr. Mueller without good cause in violation of regulations or to rescind those rules first.
Mr. Barr’s first stint as attorney general came under President George Bush, who was known for his prudent and measured approach. If confirmed, Mr. Barr would serve under a president hardly known for self-restraint. Mr. Trump repeatedly excoriated former Attorney General Jeff Sessions for recusing himself from the Russia investigation, which Mr. Trump called a “witch hunt,” and pushed him to open criminal investigations into political adversaries like Hillary Clinton.
Over hours of testimony, Mr. Barr calmly displayed a fluent grasp of policy and smoothly responded to senators of both parties, demonstrating his long experience as a Washington hand and member of the Republican legal establishment. He is widely expected to be confirmed, both because Republicans control the Senate and because Democrats are deeply suspicious of Matthew G. Whitaker, the acting attorney general whom Mr. Trump installed after ousting Attorney General Jeff Sessions in November.
Mr. Barr described being asked whether he was interested in joining Mr. Trump’s defense team in June 2017 by a friend of the president. Although Mr. Barr agreed to meet with Mr. Trump — and told him, he said, that Mr. Mueller was both a personal friend and “a straight shooter who should be dealt with as such” — he declined to join his legal team.
“My wife and I were sort of looking forward to a bit of respite and I didn’t want to stick my head into that meat grinder,” Mr. Barr said.
Asked by Senator Richard J. Durbin, Democrat of Illinois, why as a “rational person” he would want the job after seeing Mr. Trump’s “unrelenting criticism” of Mr. Sessions, Mr. Barr portrayed himself as an institutionalist.
“Because I love the department and all its components, including the F.B.I.,” Mr. Barr said. “I think they are critical institutions that are essential to preserving the rule of law, which is the heartbeat of this country.”
Mr. Barr’s testimony also touched on many other issues.
Regarding Mr. Trump’s demand for funding for a border wall, which has prompted the longest government shutdown in American history, Mr. Barr expressed qualified support for expanding barriers along the Mexican border where they could be part of “common sense” immigration enforcement. But he sidestepped questions about whether Mr. Trump could lawfully redirect military funds to build a wall without congressional authorization, as the president has threatened to invoke emergency powers to do.
Asked by Senator Dianne Feinstein, Democrat of California, about remarks he made in 2005 defending the George W. Bush administration’s “enhanced interrogation techniques” program and the idea that it was lawful to use “pain, discomfort and other things to make people talk” so long as it does not cross the line to torture, Mr. Barr said he would obey and uphold a 2015 law restricting American interrogators to using only those techniques listed in the Army Field Manual.
Under questioning about whether he had sought to push out the deputy attorney general, Rod J. Rosenstein, who is widely expected to leave if Mr. Barr is confirmed, the nominee said he had not — and, indeed, had asked Mr. Rosenstein to stay on longer for a transition period.
But the hearing repeatedly returned to Russia’s attempts to manipulate the American election process and the ongoing investigation by Mr. Mueller into Moscow’s campaign of subversion — and possible links to Mr. Trump and his associates.
Early in the hearing, Senator Lindsey Graham, Republican of South Carolina and the committee’s new chairman, brought up the F.B.I.’s newly revealed counterintelligence investigation into whether the president was working with the Russians, asking incredulously whether Mr. Barr had “heard of such a thing in all the time you have been associated with the department.”
When Mr. Barr answered that he had not, Mr. Graham sought and obtained his assurance that he would look into who opened the investigation into the president at the F.B.I. or the Justice Department and to tell the committee whether it was appropriate.
Later, Mr. Barr also defended as “entirely proper” his decision to write an unsolicited, lengthy memo to the Trump administration legal team in June arguing that laws against obstruction of justice cannot criminalize a president’s use of his constitutional powers — like when Mr. Trump fired James B. Comey as F.B.I. director.
Insisting he had not been not trying to “ingratiate” himself with the Trump administration by writing the memo, Mr. Barr downplayed it as based on mere speculation about the basis for Mr. Mueller’s obstruction inquiry. He said that he believed that other potential actions by a president, like witness tampering, would be a legitimate basis for an obstruction investigation.
In any case, he repeatedly said he would let Mr. Mueller finish his work.
The nominee also appeared to emphasize a softer vision of presidential power than the unusually expansive view he has largely advanced throughout his career — for example, previously portraying the president instead of the attorney general as the nation’s top law-enforcement official, who wields unfettered power to “start or stop a law enforcement proceeding.”
His philosophy on executive authority has raised the question of whether his permissive theories would unleash Mr. Trump. But in several ways on Tuesday, Mr. Barr appeared to walk back or qualify some of his earlier writings, putting greater emphasis on the Justice Department’s independence and legal limits on the presidency.
For example, Mr. Barr said that if a president directed the Justice Department to close an investigation to protect himself or his family, that would violate the Constitution. And asked by Senator Patrick J. Leahy, Democrat of Vermont, whether a president could pardon someone in exchange for a promise not to incriminate him, Mr. Barr said, “That would be a crime.”
He also pledged to seek the advice of ethics lawyers in the Justice Department about whether he should recuse himself from overseeing the Russia inquiry, while stopping short of committing to accepting their recommendation. Late last year, Justice Department ethics officials recommended to Mr. Whitaker that he recuse from overseeing that investigation, but Mr. Whitaker declined to do so.
Separately, Representative Jerrold Nadler of New York, the chairman of the House Judiciary Committee, announced in a letter on Tuesday that Mr. Whitaker had agreed to testify publicly before his committee on Feb. 8, regardless of the status of the border wall impasse or “whether or not the Senate has confirmed a new attorney general.” The hearing promises to be a blockbuster session, and should turn on many of the same questions Mr. Barr faced, including about Mr. Mueller.
The fate of Mr. Mueller’s findings — an expected report — was a recurring topic. Mr. Barr said that Mr. Mueller’s report to the attorney general would be “confidential,” but that the attorney general would then produce his own report to Congress based on that material. He said that he intended to be as transparent as possible given grand-jury secrecy rules, but that he would not let the White House edit or change it, as the president’s lawyer Rudolph W. Giuliani had suggested might occur.
“That will not happen,” Mr. Barr said.
And Mr. Barr repeatedly said Mr. Mueller, whom he portrayed as a longtime friend, must be permitted to resolve the investigation.
“It is in the best interest of everyone — the president, Congress and, most importantly, the American people — that this matter be resolved by allowing the special counsel to complete his work,” Mr. Barr said. He added: “I will follow the special counsel regulations scrupulously and in good faith, and on my watch, Bob will be allowed to finish.”