President Donald Trump's nominee to be US attorney general has vowed he will not be bullied by the president.
William Barr also told his confirmation hearing the US inquiry into Russia's alleged 2016 election meddling is not a witch hunt, as Mr Trump labels it.
As top US law officer, Mr Barr would lead the Department of Justice, which is meant to be politically independent.
But Democrats asked why he wrote in a legal memo last year that an aspect of the probe was "fatally misconceived".
How did the nominee assert independence?
Mr Barr sought to assure senators on the Senate judiciary committee in Tuesday's hearing that he is no Trump loyalist.
Democrats on the committee wanted to know if Mr Barr - who was also attorney general under President George HW Bush - could stand up to Mr Trump.
"I will not be bullied into doing anything I think is wrong by anybody whether it be editorial boards or Congress or the president," he said.
"I am going to do what I think is right."
He repeatedly said special counsel Robert Mueller must be allowed to complete his inquiry into whether the Trump campaign colluded with an alleged Russian plot to influence the 2016 US presidential election.
"I think the Russians interfered or attempted to interfere in the election and we have to get to the bottom of it," he said.
"On my watch, Bob [Mueller] will be allowed to complete his work," Mr Barr said of the inquiry, which has cast a cloud over the Republican president's two years in office.
"I don't believe Mr Mueller would be involved in a witch hunt," he also said in a remark that contradicts Mr Trump's own statements.
The nominee also told senators he had been a personal friend of Mr Mueller for 30 years.
You may also be interested in:
Democratic Vermont Senator Patrick Leahy asked if a US president could pardon someone on condition that person agreed not to incriminate him.
"No, that would be a crime," Mr Barr responded.
Mr Trump's critics have speculated he might offer clemency to two former aides who fell foul of the Mueller inquiry.
Paul Manafort and Michael Flynn were convicted of crimes including bank fraud and lying to federal agents.
In another key moment, Mr Barr was asked about former Attorney General Jeff Sessions' self-recusal from the Russia inquiry, a decision that infuriated Mr Trump.
Mr Barr said his predecessor "did the right thing".
Mueller is all that matters
Analysis by Anthony Zurcher, BBC Washington
The US attorney general sets the government's criminal justice policies, oversees an army of investigators and prosecutors, and provides administration guidance on a wide range of legal issues. He or she is both the nation's top prosecutor and law enforcement officer.
Confirmation hearings for the post would involve close scrutiny at any time and in any situation. At the moment, however, nominee William Barr's views on the ongoing Russia investigation are all that seem to matter.
Mr Barr is saying the right things so far. He assured senators he has the highest respect for special counsel Robert Mueller and will not interfere with his probe. He said he will not be bullied or influenced by anybody, including the president.
Set against this testimony is Mr Barr's past written criticism of the special counsel's conduct. Democrats will have to decide whether his recent promises are enough to overcome their concerns.
Given Mr Barr's long history of government service and the fact that Republicans hold a majority in the Senate, successful confirmation seems fairly certain. Democrats will do their best to lock Mr Barr into supporting the Russia probe, but the only remaining question is how many will eventually vote for him.
So why are Democrats wary?
Democrats suggested a critical 20-page memo that Mr Barr wrote last year to the justice department was a "job interview" to impress Mr Trump.
But the nominee called that suggestion "ludicrous".
He defended his "entirely proper" decision to criticise Mr Mueller's investigation into whether the president had sought to obstruct justice.
Mr Barr had written that the special counsel should not be able to interview the president about his decision to fire FBI Director James Comey.
On Tuesday the nominee told senators former senior officials often gave their views on significant matters.
He said he would consult ethics officials on whether he would need to recuse himself because of the memo, but made clear the final decision would be his.
Mr Barr stopped short of promising to release Mr Mueller's report.
He said he hoped to disclose "as much" of the findings as was "consistent with the rules and regulations".