The U.S. Senate voted to confirm Jeff Sessions as attorney general on Wednesday night after the contentious final hours of debate about his qualifications.

The Republican-controlled Senate voted to make the former GOP senator from Alabama the United States’ top law enforcement official after a day of partisan wrangling. The chamber voted 52-47, largely along party lines, to confirm Sessions.

Sessions, 70, is an immigration hard-liner who had served in the Senate since 1997 and was among the first members of Congress to endorse President Donald Trump as a candidate. He previously was Alabama attorney general and a U.S. attorney for the Southern District of Alabama.

Democrats have raised concerns about racism accusations that partly cost Sessions a federal judgeship in the 1980s, as well as fears that he could try to restrict voting rights or fail to check Trump’s policies if they test the bounds of the law. Republicans have defended Sessions’ long history as a public official, arguing that he defended voting rights and saying racism accusations are unfounded.

Recent tension in the Senate over Trump’s Cabinet nominees boiled over late Tuesday when Sen. Elizabeth Warren, D-Mass., tried to read a 1986 letter by the widow of Martin Luther King Jr. criticizing Sessions. Coretta Scott King raised concerns about Sessions’ history and qualifications during the confirmation process for a federal judgeship, which he did not get.

Senate Republicans rebuked Warren, cutting her off from debate, for attempting to read the letter. They invoked a rule aiming to bar senators from impugning their colleagues.

Democrats rallied around Warren, and several other Democratic senators read the letter Wednesday without GOP objection. Senate Majority Leader Mitch McConnell, R-Ky., defended the decision.

“Sen. Warren was giving a lengthy speech. She had appeared to violate the rule. She was warned. She was given an explanation. Nevertheless, she persisted,” McConnell said.

Warren told MSNBC on Wednesday that Democrats lacked numbers to block Sessions. But she added that “we are the party of opposition, and that is our job” to oppose him.

Sessions’ confirmation process proved divisive well before the confirmation vote. Sen. Cory Booker, D-N.J., testified against Sessions during his confirmation hearing, becoming the first senator to do so against a colleague.