Feb. 8 (UPI) — The Senate narrowly voted to approve Alabama Sen. Jeff Sessions on Wednesday as the 84th attorney general of the United States, bringing an end to what had been one of President Donald Trump’s most disputed Cabinet appointments.

The upper chamber voted Wednesday evening on Sessions’ appointment to the highest law enforcement post in the country, allowing him to survive what had been a nomination fraught with opposition from Senate Democrats.

The final Senate vote tally was 52-47 in Sessions’ favor. One senator did not vote.

Many Democrats opposed Sessions for the Justice Department post largely over racial accusations early in his career.

In the end, though, Democrats weren’t able to persuade the GOP-controlled chamber to torpedo Sessions’ candidacy.

Sessions takes over the role of attorney general from Loretta E. Lynch, who was former President Barack Obama’s Justice Department chief for two years. He also replaces Dana J. Boente, who was named acting attorney general late last month.

Sessions, 70, served as a U.S. attorney under former President Ronald Reagan and later Alabama attorney general from 1995 to 1997. He has been serving in the Senate for the last 20 years.

In 1986, Sessions was denied a federal judgeship over concerns about his racial views, which some claimed included efforts to suppress black voters. Coretta Scott King, widow of civil rights icon Martin Luther King, Jr., appealed to the Senate at the time, in a letter, to reject his nomination.