WASHINGTON — Attorney General nominee William P. Barr testified Tuesday to the Senate Judiciary Committee that he would let special counsel Robert Mueller’s investigation continue to its conclusion, responding to Democrats’ concerns that some of his past statements indicate he might favor the president.

California Sen. Dianne Feinstein, the top Democrat on the committee, said that “some of your past statements on the role of attorney general and presidential power are concerning. For instance,you have said in the past that the attorney general is the president’s lawyer.”

Barr, who was attorney general from 1991 to 1993 under President George H.W. Bush, said Bush never sought any promises and President Donald Trump also has not asked for promises to act in certain ways.

“If appointed, I will serve with the same independence that I did in 1991,” he said. “My allegiance will be to the rule of law, the Constitution, and the American people.”

Feinstein urged Barr to create a prompt report of the investigation for the Senate.

She also asked Barr how he would respond if Trump ordered him to halt a criminal investigation. Barr responded that such a request would be an abuse of power. Feinstein then asked Barr if it would be a similar abuse of power if the president fired an attorney general for political reasons.

“No, because appointments are political things,” Barr said.

Sen. Patrick Leahy, D-Vt., warned that Trump would expect Barr to do the president’s bidding, specifically for the Russia investigation. He was skeptical of Barr’s ability to support it, in reference to Barr’s previous criticism of Mueller and the Russia investigation.

Barr interrupted Leahy. “How have I criticized the Russia probe? I am in favor of as much transparency as can be consistent with the rules and the law,” he said.

Leahy referred to Barr’s memo to the Trump administration arguing Mueller should not be permitted to investigate the president for how he decided to exercise his executive powers.

In response to Sen. Mazie Hirono, D-Hawaii, he explained the memo only questioned whether the firing of former FBI Director James Comey was really an obstruction of justice, as critics said. “You have to remember my memo is on a specific statute and a specific theory of the Mueller investigation,” he said.

In response to Nebraska Republican Sen. Ben Sasse’s question about the purpose of the investigation, Barr called Russia a “potent rival” of our country.

Committee Chairman Sen. Lindsey Graham pushed Barr to also investigate disrespectful messages among FBI agents against the President.

Sen. Chuck Grassley, R-Iowa, questioned Barr about his previous crackdown on the penal system from his work with the Bush administration. “I don’t think comparing the policies of 1992 to now is really fair,” Barr said. He said he has no problem with enforcing the new approach to prison reform, specifically with regards to the First Step Act passed with bipartisan support in December.

Sen. Elizabeth Warren, who has announced the creation of an exploratory committee for a potential run for president in 2020, said she will vote against Barr’s confirmation by the full Senate if the committee sends his nomination to the floor. She criticized his past position, his want to overturn Roe v. Wade, his “terrible record” on criminal justice and his prejudgment on the Mueller investigation.

“This is up to the Republicans, they have a majority,” Warren said.

Gabrielle Bienasz contributed reporting for this article.