WASHINGTON, Jan. 15 (CGTN) -- President Donald Trump's nominee for U.S. attorney general, William Barr, told lawmakers on Tuesday he would protect a federal probe into Russian election meddling from political pressure, stressing he would bring independence to the job and not shy away from breaking ranks with the administration.

"I will not be bullied into doing anything that I think is wrong – by anybody, whether it be editorial boards or Congress or the president," Barr said at his confirmation hearing before the Senate Judiciary Committee. "I'm going to do what I think is right."

Barr is expected to win confirmation in the Republican-controlled Senate to serve as the nation's top law enforcement officer, which would put him in charge of Special Counsel Robert Mueller's investigation into Russia's interference in the 2016 election and any possible collusion between Moscow and Trump's campaign.

"On my watch, Bob will be allowed to complete his work," Barr said.

Democrats worry that Trump's administration may try to undercut the investigation, which has clouded Trump's two years in office and has been a frequent target of the president and his allies.

Barr, who was attorney general under Republican President George H.W. Bush in the 1990s, said his primary loyalty would be to the rule of law, not Trump. He said he did not seek out the job and was reluctant to accept when Trump offered it to him.

While he staked out a position of independence, Barr spoke broadly in favor of many of the tough immigration policies that have been pushed by Trump. He said he believed in the use of border walls, and criticized "sanctuary cities" that shield from deportation immigrants who are in the country without authorization.

"We need money right now for border security, including walls and barriers," he said.

Much of the questioning centered on the Mueller probe, which Trump frequently criticizes as a "witch hunt" while denying any collusion with Russia or obstruction of justice. Russia has denied U.S. intelligence agencies' findings that it interfered in the 2016 election.

Barr said he agreed with Mueller's charge that Russian entities interfered in the election, or at least tried to do so.

He said he described Mueller, a longtime friend, as a "straight shooter" when Trump asked about him. "I don't believe Mr. Mueller would be involved in a witch hunt," Barr said.

If Trump asked him to fire Mueller without good cause, "I would refuse to carry out that instruction," he said.