The US senate voted on Wednesday night to confirm senator Jeff Sessions as the next attorney general despite fierce Democratic opposition to the Alabama Republican over his record on civil rights and immigration.
The 52-47 vote broke largely along party lines and capped weeks of divisive battles over Mr Sessions, an early supporter of Donald Trump and one of the senate's most conservative Republicans.
Democrats have blasted the Alabama senator over his ties to Mr Trump and his record on civil rights and immigration. Republicans lauded his four decades in public service and his commitment to fairness and the rule of law.
"Any attorney general must be able to stand firm for the rule of law even against the powerful executive that nominated him or her. In this administration I believe that independence is even more necessary," said Tim Kaine, the Democratic senator from Virginia.
"His (Sessions') record raises doubts about whether he can be a champion for those who need this office most and it also raises doubts about whether he can curb unlawful overreach" by Mr Trump.
Republicans say Mr 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.
"He's honest. He's fair. He's been a friend to many of us, on both sides of the aisle," Mitch McConnell, the Senate leader, said. "It's been tough to watch all this good man has been put through in recent weeks. This is a well-qualified colleague with a deep reverence for the law. He believes strongly in the equal application of it to everyone."
Mr Sessions won unanimous backing from Senate Republicans but picked up the support of just one Democrat, Joe Manchin of West Virginia.
Mr Sessions told his colleagues #he hopes the intensity of senate debate will die down and "maybe somehow we get along better."
He also thanked the president for nominating him, adding that Mr Trump believes in the rule of law and in protecting the American people from crime and violence.
Mr Sessions is urging senators to "agree on what we can agree on" but not to denigrate people who disagree, saying it's not a healthy trend. He also confirmed his resignation as US senator would be effective at 11:55pm EST (4:55am GMT).
The confirmation came a day after Elizabeth Warren, a high-profile Democratic senator, tried to quote Martin Luther King’s widow in a senate speech only to be silenced by the Republican majority senate.
Coretta Scott King had written a letter in 1986, when Mr Sessions was proposed as a federal judge in Alabama, arguing that he was racist and unfit to be a judge.
Mrs Warren was stopped and rebuked by Mr McConnell but later read the letter outside the senate, streaming video live on Facebook to more than five million people.
Mr Sessions' nomination to a federal judgeship was rejected three decades ago by the Senate Judiciary Committee after it was alleged that as a federal prosecutor he had called a black attorney "boy" and had said organisations like the NAACP and the American Civil Liberties Union were un-American.
At his hearing last month, Mr Sessions said he had never harboured racial animus, saying he had been falsely caricatured.
"We will not be disheartened. Jeff Sessions doesn't stand a chance against our team of persistent progressives," Nancy Pelosi, the top US house of representatives Democrat, said on Twitter.
Meanwhile Jesse Jackson, the veteran civil rights activist, called Mr Sessions' confirmation "the most devastating blow to civil rights in 50 years" and "a stab in the heart of the civil rights movement."
"The most devastating blow to civil rights in 50 years.It's a stab in the heart of the civil rights movement," reverend Jesse Jackson, the veteran civil rights activist, said on Twitter following the vote.
The confirmation was also criticised by the Human Rights Campaign, America's largest civil rights organisation working to achieve LGBTI equality, who said in a statement that "the man in charge of enforcing hate crimes laws doesn’t think they should exist."