The Senate on Thursday confirmed William Barr as attorney general, placing the veteran government official and lawyer atop the Justice Department as special counsel Robert Mueller investigates Russian interference in the 2016 election.

The Senate voted 54-45 to confirm him, mostly along party lines. Barr, who previously served as attorney general from 1991 to 1993, will succeed Jeff Sessions. Trump pushed Sessions out of office last year after railing against his decision to recuse himself from the Russia investigation.

As the country's chief law enforcement officer, Barr will oversee the remaining work in Mueller's investigation into potential coordination between the Kremlin and the Trump campaign and decide how much Congress and the public know about its conclusion. He'll also take over a department that Trump has publicly assailed, often questioning the integrity and loyalty of those who work there.

Democrats, who largely voted against Barr, said they were concerned about his non-committal stance on making Mueller's report public. Barr promised to be as transparent as possible, but said he takes seriously the Justice Department regulations that dictate Mueller's report should be treated as confidential.

Opponents of Barr also pointed to a memo he wrote to Justice officials before his nomination. In it, he criticized Mueller's investigation for the way it was presumably looking into whether Trump had obstructed justice. Barr wrote that Trump could not have obstructed justice by firing former FBI Director James Comey since it was an action the president was constitutionally entitled to take.

That view has alarmed Democrats, especially since the obstruction inquiry has been central to Mueller's investigation.

"Mr. Barr's views about the power of the president are especially troubling in light of his refusal to commit to making the special counsel's findings and the report publicly available," said California Sen. Dianne Feinstein, the top Democrat on the Judiciary panel. Feinstein said the attorney general should be someone who is "objective, who is clearly committed to protecting the interest of the people, the country and the Constitution."

When Barr is sworn into office this week, he will be tasked with restoring some stability after almost two years of open tension between Trump and Justice officials. Trump lashed out at Sessions repeatedly before he finally pushed him out in November, and he has also publicly criticized Mueller and his staff, calling the probe a "witch hunt" and suggesting they are out to get him for political reasons. The criticism extended to Deputy Attorney General Rod Rosenstein, who appointed Mueller as special counsel. Rosenstein is expected to leave the department shortly after Barr takes office.

Trump has directed some of his strongest vitriol at department officials who were part of the decision to start investigating his campaign's Russia ties in 2016 and also the decision to clear Democrat Hillary Clinton in an unrelated e-mail probe that same year. Trump has repeatedly suggested that the agents and officials, many of whom have since left, were conspiring against him. In an interview aired Thursday, fired former FBI Deputy Director Andrew McCabe told CBS' "60 Minutes" that Justice Department officials discussed bringing the Cabinet together to consider using the Constitution's 25th Amendment to remove Trump from office after the president fired Comey.

Trump responded to the McCabe interview with a tweet: "Disgraced FBI Acting Director Andrew McCabe pretends to be a 'poor little Angel' when in fact he was a big part of the Crooked Hillary Scandal & the Russia Hoax - a puppet for Leakin' James Comey. I.G. report on McCabe was devastating."

In his hearing last month, Barr vowed that he would not "be bullied," said Mueller's investigation is not a witch hunt and agreed that Sessions was right to recuse himself from the probe. Barr said he was a friend of Mueller's and repeatedly sought to assuage concerns that he might disturb or upend the investigation as it reaches its final stages.

When Trump nominated Barr, he called him "a terrific man" and "one of the most respected jurists in the country."

"I think he will serve with great distinction," Trump said.

Since Sessions departed last year, the position has been temporarily filled by Acting Attorney General Matthew Whitaker, who has come under fire from Democrats for his past criticism of the Mueller probe. Whitaker said last month that he believed Mueller's investigation was nearly complete — a departure for the Justice Department, which rarely comments on the state of the investigation.

Lawmakers in both parties have said a permanent replacement for Sessions was urgently needed.

"All I can say is if America ever needed a steady hand at the Department of Justice, it is now," Sen. Lindsey Graham, the Republican chairman of the Judiciary Committee, said on the Senate floor Tuesday. "Mr. Whitaker has done a good job as interim attorney general, but we are looking for a new person to bring stability, improve morale, and be a steady hand and mature leadership at a time when our country is very much divided."

Graham said Barr stood out "head and shoulders" above others who could have been nominated.

"To the American people, you can go to bed here soon knowing that the Department of Justice is in good hands," Graham said.

Three Democrats — Sens. Doug Jones of Alabama, Joe Manchin of West Virginia and Kyrsten Sinema of Arizona — joined Republicans in voting to confirm Barr. Republican Sen. Rand Paul of South Carolina voted against him, citing concerns about Barr's views on surveillance, among other issues.