WASHINGTON — The Senate voted to confirm Merrick B. Garland on Wednesday to serve as attorney general, giving the former prosecutor and widely respected federal judge the task of leading the Justice Department at a time when the nation faces domestic extremist threats and a reckoning over civil rights.
Judge Garland was confirmed 70 to 30, with 20 Republicans joining all 50 Democrats in supporting him. He is expected to be sworn in at the Justice Department on Thursday.
“Attorney General Garland will lead the Department of Justice with honesty and integrity,” Senator Richard J. Durbin, Democrat of Illinois and the chairman of the Senate Judiciary Committee, said in a statement. “He has a big job ahead of him, but I can’t think of anyone I’d rather have in his place.”
Judge Garland has vowed to restore public faith in a department embroiled in political controversy under President Donald J. Trump, who sought both to undermine federal law enforcement when it scrutinized him and his associates and to wield its power to benefit him personally and politically.
At his confirmation hearing, Judge Garland, 68, said that becoming attorney general would “be the culmination of a career I have dedicated to ensuring that the laws of our country are fairly and faithfully enforced and the rights of all Americans are protected.”
Judge Garland has amassed decades of credentials in the law. He clerked for Justice William J. Brennan Jr., worked for years as a federal prosecutor and led major investigations into the 1995 Oklahoma City bombing and others before being confirmed to the District of Columbia Court of Appeals in 1997.
He was chosen by President Barack Obama in 2016 to join the Supreme Court only to see his nomination held up for eight months in an audacious political maneuver by Senator Mitch McConnell, Republican of Kentucky and the majority leader at the time. The move ultimately allowed Mr. Trump to choose his own nominee to fill the seat.
But Mr. McConnell, who said last year that he would support Judge Garland to serve as attorney general, was among the Republicans who voted for his confirmation and a day earlier to end debate over his nomination, paving the way for the full Senate to vote.
“I’m voting to confirm Judge Garland because of his long reputation as a straight shooter and legal expert,” Mr. McConnell said on the Senate floor before he cast his vote.
Mr. McConnell said that he hoped Judge Garland would bring his “no-nonsense approach” to confront the challenges facing the Justice Department and the nation, and that he would keep the department on a centrist path.
Department employees have said that Judge Garland’s performance at his confirmation hearing, a largely amicable affair, made them hopeful that he would restore honor to the agency and lift up its 115,000-person work force demoralized by the Trump-era rancor.
Restoring trust inside and outside the Justice Department will be key, as Judge Garland will immediately oversee politically charged investigations, including a federal tax fraud inquiry into President Biden’s son, Hunter, and a special counsel inquiry into the Russia investigation.
The department will also be involved in civil and criminal cases related to issues that have bitterly divided the country, including systemic racism, policing, regulation of big technology companies, L.G.B.T.Q. rights and other civil liberties matters.
Judge Garland will also confront the rise of domestic extremism as law enforcement officials continue investigating the Jan. 6 assault on the Capitol. His first briefings this week were expected to be with the F.B.I. director, Christopher A. Wray, to discuss the threat and with Michael R. Sherwin, the departing top prosecutor in Washington who has led the Justice Department inquiry.
The Capitol riot investigation has grown closer to Roger J. Stone Jr., one of Mr. Trump’s allies, and the F.B.I. has found evidence of communications between right-wing extremists and White House associates, underscoring how closely Mr. Trump had aligned himself with such groups during his presidency.
During his confirmation hearing, Judge Garland said he would rely on his experience leading the department’s investigation into the Oklahoma City bombing to help combat domestic extremism.
“I supervised the prosecution of the perpetrators of the bombing of the Oklahoma City federal building, who sought to spark a revolution that would topple the federal government,” he said. “I will supervise the prosecution of white supremacists and others who stormed the Capitol on Jan. 6, a heinous attack that sought to disrupt a cornerstone of our democracy, the peaceful transfer of power to a newly elected government.”
Republicans who voted against Judge Garland, including Senator Tom Cotton of Arkansas, said they feared that his reputation as a fair-minded judge would not stop him from embracing a “radical agenda” as attorney general.
During the Clinton administration, Judge Garland was chosen by Jamie Gorelick, the deputy attorney general, to serve as her top deputy. He oversaw the investigation into the Oklahoma City bombing, which led to the conviction and execution of Timothy McVeigh, and went on to supervise other high-profile cases that included the Unabomber, Theodore J. Kaczynski, and the bombing at the Atlanta Olympics in 1996.
The investigations helped cement Judge Garland’s reputation as a fair-minded centrist. After his appeals court confirmation, he did not make major headlines again until 2016, when Mr. Obama nominated him to serve on the Supreme Court, a choice that won bipartisan support, including from conservative stalwarts like the former Whitewater prosecutor Ken Starr.
But Mr. McConnell refused to consider his nomination, and Mr. Trump selected Neil M. Gorsuch to fill the vacant seat in 2017. Judge Garland stayed on at the Court of Appeals.