WASHINGTON — The Senate confirmed William Barr as U.S. attorney general Thursday, keeping him in place to oversee the Mueller investigation into possible Russian interference in the 2016 presidential election.

The Senate voted 54-45, largely along party lines.

He was scheduled to be sworn in at 4:45 p.m. Thursday in the Oval Office by Chief Justice John Roberts.

Barr will fill the role vacated by Jeff Sessions, who was forced out by President Donald Trump last year. Sessions had refused to recuse himself from the Robert Mueller investigation.

This will be Barr's second stint as the country's top law enforcement officer. He was previously in the role from 1991-1993, during President George H.W. Bush's administration.

Trump has been highly critical of the special counsel's investigation, repeatedly calling it a "witch hunt." Several of Trump's associates — Paul Manafort, Michael Flynn, George Papadopoulos, and Michael Cohenhave pleaded guilty to various financial and perjury crimes.

Most Democrats had been opposed to the confirmation of the politically conservative Barr, painting him as someone who wouldn't be impartial as the Mueller probe went on. Barr once referred to the role of attorney general as "the president's lawyer," and pointed to a 19-page memo he wrote that criticized part of the special counsel's investigation.

Before the Senate Judiciary Committee last month, Barr did not commit to releasing the special counsel's final report unchanged but said he would put out "as much as I can."

"I am not going to do anything that I think is wrong, and I will not be bullied into doing anything I think is wrong," Barr said at the time, "whether it be editorial boards, or Congress or the president. I'm going to do what I think is right."

Information from the Associated Press and CNN was used in this report.