William P. Barr was confirmed Thursday as the U.S. attorney general, putting him in command of the Justice Department at one of the most politically charged moments in its history.

Senators voted 54 to 45, mostly along party lines, to confirm Barr, who will now supervise special counsel Robert S. Mueller III’s inquiry into whether Donald Trump’s campaign conspired with Russia to influence the 2016 election.

Among Barr’s first major decisions will be what to tell the public about the results of that investigation — a choice that will force the attorney general to balance the public’s insatiable appetite for information, Justice Department policies that favor secrecy and the desires of a president unlikely to be satisfied with anything but total exoneration.

People familiar with the matter said Barr has all but settled on a new second-in-command, with Rod J. Rosenstein, the deputy attorney general who appointed Mueller, expected to leave soon. Barr has not disclosed any names publicly.

While Republicans hailed Barr’s confirmation, Democrats and left-leaning advocacy groups said they remained wary of President Trump’s appointee, who at his confirmation hearing notably declined to promise that he would release Mueller’s report. Sen. Dianne Feinstein (Calif.), the Senate Judiciary Committee’s top Democrat, said in a statement Thursday that she considered Barr’s lack of commitment to releasing Mueller’s report “disqualifying” and that she worried he would be unable to stand up to Trump.

“While I opposed Bill Barr’s nomination, it’s my hope that he’ll remember he is the people’s lawyer, not the president’s lawyer,” Feinstein said.

The vote’s outcome was unsurprising. Trump’s nominee had cleared a procedural hurdle earlier this week by a 55-to-44 vote — even winning a few Democratic votes in an era gripped by partisanship. On Thursday, three Democrats crossed the aisle to vote for Barr: Sens. Kyrsten Sinema (Ariz.), Doug Jones (Ala.) and Joe Manchin III (W.Va.).

Sen. Rand Paul (R-Ky.) voted against the nomination.

Barr is widely respected in the conservative legal community and has vast experience in the Justice Department — having served previously as the attorney general, deputy attorney general and head of the Office of Legal Counsel. But his reentry comes at a time unlike almost any other.

Trump has relentlessly attacked the department and Mueller’s team in particular, deeming their investigation a “witch hunt” and vigorously disputing that he did anything wrong, during his campaign or since becoming president. There are some signs, too, that the special counsel investigation could be concluding — leaving Barr in the position of deciding what comes next.

A person familiar with the matter said Barr, who has visited the Justice Department frequently in recent weeks, has had preliminary discussions about the logistics surrounding the conclusion of Mueller’s probe. The person stressed, though, that Barr has not been briefed on the substance of Mueller’s investigation and that the logistical discussions have been far from advanced.

Barr was formally sworn in Thursday afternoon by Chief Justice John G. Roberts Jr. in an Oval Office ceremony.

Whether and to what extent Barr will release Mueller’s findings remain a mystery, and there are some signs the public might be left unsatisfied.

The special counsel regulations call for Mueller to provide the attorney general with a “confidential report” explaining who he did and did not decide to prosecute, and for Barr to notify Congress of the investigation’s end and of any steps Mueller wanted to take that were vetoed.

The regulations give Barr some latitude to release information publicly, though Barr noted at his confirmation hearing that under normal circumstances, prosecutors would not reveal information about those they chose not to charge. To the frustration of some lawmakers, especially Democrats, he declined to guarantee he would release Mueller’s findings in full, though he vowed to be as transparent as possible.

Sens. Charles E. Grassley (R-
Iowa) and Richard Blumenthal (D-Conn.) have proposed legislation that would force Barr to release Mueller’s findings, and no matter what Barr decides, the Democratic-controlled House is likely to try to pry loose any information it can, including by calling Mueller to testify on Capitol Hill.

In the last politically charged, high-profile investigation — the inquiry into Hillary Clinton’s use of a private email server while serving as secretary of state — then-FBI Director James B. Comey briefed lawmakers publicly on the bureau’s work, and the FBI later released an investigative summary and reports of interviews.

If past is precedent, Barr will probably have to endure attacks from the president on the department he leads — particularly if Mueller’s investigation continues much longer. Trump was particularly ruthless with his former attorney general, Jeff Sessions, whom Trump never forgave for recusing himself from the investigation that Mueller would later come to lead.

At one point, Trump said publicly of Sessions, “I don’t have an attorney general” — a remarkable humiliation of the country’s top law enforcement official that, by the time Trump uttered it, had become almost unsurprising because of his constant attacks.

Barr has long been a proponent of giving the president broad authority, and in private practice he sent a memo to Justice Department leaders critical of what he saw as Mueller’s legal theory of how the president could have obstructed justice. But he has also vowed to let the special counsel conclude his work and said he considers Mueller a friend. The two men worked together when Barr was last in the Justice Department.

Timothy Flanigan, who worked with Barr in the Justice Department previously and is now the chief legal officer for Cancer Treatment Centers of America, said in a prior interview that he observed Barr and Mueller working together and that the two have a “strong relationship . . . based on mutual respect.” He said he recalled Barr occasionally ribbing Mueller — who is serious to a fault — with jokes at staff meetings.

Flanigan said that when he first learned of Barr’s nomination, his main question was, “Why would he do this?”

“He’s got such a great résumé, great career, wonderful legacy of public service, and this is a tough assignment by any measure,” Flanigan said. “Some might say it’s kind of a lose-lose assignment.”

Flanigan said Barr is skilled at getting ahead of potential problems and might be able to avert conflicts with the president or others before they come to pass. He called Barr a hands-on manager who will probably be interested in broad policy issues and the Justice Department’s efforts to combat gangs and the opioid crisis.

And, he said, “if Bill starts getting the tweet treatment, Bill is a tough guy. He’s a tough, tough guy. Not that Jeff Sessions wasn’t, but I don’t think Bill’s just going to sit there and take it. I think he would make sure that the president understood that it is not really a smart thing to be lambasting the attorney general.”

Barr also is likely to soon select his own people to fill the department’s upper ranks — though they will have to be formally appointed by Trump, people familiar with the matter said. Rosenstein, the deputy attorney general, has told people he expects to step down soon , though he is willing to stay on to ensure a smooth transition. His departure would leave the Justice Department’s No. 2 and No. 3 positions unfilled by Senate-confirmed leaders.

On Thursday, before senators voted, Rosenstein was forced again to defend himself against allegations from former acting FBI director Andrew McCabe that he suggested wearing a wire to surreptitiously record Trump, or having Cabinet members invoke the 25th Amendment to remove the president from office, early in the administration. Rosenstein has vaguely disputed those allegations, and Trump has seemed to side with him over McCabe — though McCabe is set to release a book next week, and his interviews to promote it could cause new headaches for Rosenstein.

A person familiar with the matter said that, in addition to replacing Rosenstein, Barr is also contemplating who might fill the No. 3 spot. The nominations could be announced in coming weeks, according this person, who spoke on the condition of anonymity to discuss personnel issues.