Alabama Sen. Jeff Sessions was confirmed as attorney general in a 52-47 vote Wednesday night, closing the chapter on another contentious pick for President Donald Trump’s cabinet.

The confirmation was voted largely along party lines, with all but one Democrat — West Virginia Sen. Joe Manchin — voting no and every Republican voting yes.

Arizona Sens. John McCain and Jeff Flake were among the group who voted to confirm Sessions on Wednesday. The pair also voted to confirm Betsy DeVos for education secretary and Rex Tillerson for secretary of State.

In a statement Wednesday, Flake acknowledged that he and Sessions “may not agree on every issue,” but that he is a “good man who has always been courteous and thoughtful during our time as colleagues in the Senate.”

Sessions faced a firestorm of Democratic criticism over his record on civil rights and other issues.

Democrats contended Sessions is too close to Trump, too harsh on immigrants, and weak on civil rights. They asserted he wouldn’t do enough to protect voting rights of minorities, protections for gay people, the right of women to procure abortions, and immigrants in the country illegally to receive due process.

Republicans argued Sessions has demonstrated over a long career in public service — and two decades in the Senate — that he possesses integrity, honesty, and is committed to justice and the rule of law.

Majority Leader Mitch McConnell, R-Ky., called Sessions “honest” and “fair” in an interview Wednesday.

“It’s been tough to watch all this good man has been put through in recent weeks,” McConnell said. “This is a well-qualified colleague with a deep reverence for the law. He believes strongly in the equal application of it to everyone.”

Sessions boasted unanimous backing from fellow Republicans and cleared a procedural vote Tuesday afternoon by a 52-47 margin.

Sessions was a prominent early backer of Trump, a supporter of his hard line on illegal immigration and joined Trump’s advocacy of a wall along the U.S.-Mexico border.

Sessions has pledged to crack down on illegal immigration, gun violence and the “scourge of radical Islamic terrorism.”

Though he said he would prosecute immigrants who repeatedly enter the country illegally and criticized as constitutionally “questionable” an executive action by Obama that shielded certain immigrants from deportation, he said he did “not support the idea that Muslims, as a religious group, should be denied admission to the United States.”

Next in line for confirmation is Rep. Tom Price, R-Ga., Trump’s pick for health secretary. The Senate planned to vote Wednesday evening to clear Democratic procedural obstacles to his nomination, and final approval seemed certain.

The Associated Press contributed to this report.

Follow @KTAR923