Sessions has been one of Mr. Trump’s closest and most consistent allies, and he was the first senator to announce his support for the president-elect. An architect of Mr. Trump’s immigration, counterterrorism and trade policies, Sessions was also considered for secretary of defense. The Trump transition team pronounced itself “unbelievably impressed” with Sessions in a statement, citing his work as a U.S. attorney and state attorney general in Alabama. Appointing him the nation’s top prosecutor is sure to be controversial, though.

He’s been through the Senate confirmation process before, with mixed success. And confirming the four-term lawmaker this time around, even in a Republican-controlled chamber, is not guaranteed. He did make it through a Republican-controlled Senate in 1981, when they approved him to be the U.S. attorney for the Southern District of Alabama.

But then, nominated for a federal judgeship in 1986, Sessions, R-Ala., was dogged by racist comments he was accused of making while serving as U.S. attorney. A black assistant U.S. attorney accused Sessions of having addressed him as “boy,” and that he condemned the NAACP as “un-American” and “communist-inspired.”

“Mr. Sessions is a throwback to a shameful era, which I know both black and white Americans thought was in our past,” the late Massachusetts Democrat, Sen. Edward Kennedy, said during the 1986 confirmation hearing. “It is inconceivable to me that a person of this attitude is qualified to be a U.S. attorney, let alone a U.S. federal judge.”

During the hearing, a former assistant U.S. attorney, Thomas Figures, who is black, said Sessions referred to him as “boy,” and told him to be careful what he said to “white folks.” Sessions said he never called Figures “boy,” but Kennedy produced a letter from an organization of black lawyers that said Figures made the allegation about Sessions to the organization’s investigators at least twice.

Sessions told the committee that he told Figures to be careful what he said to “folks.”

“I believe that the statements and actions of Mr. Sessions regarding race, and regarding civil rights, impact tremendously on whether he is decent,” Figures told the committee. Figures died in 2015.

Sessions was also criticized for joking in the presence of an attorney with the Justice Department’s Civil Rights Division that the Ku Klux Klan was “OK” until he learned they smoked marijuana. During his confirmation hearing, he said his comment about the Klan “was a silly comment, I guess you might say, that I made.”

Sessions told the committee he made the joke while his office was investigating the 1981 murder of Michael Donald, a black man who was kidnapped, beaten and killed by two Klansmen who slit his throat and then hanged his body in a tree in Mobile, Alabama. The two men were later arrested and convicted.

Sessions said he never meant the joke to suggest he supported the Klan. He said the joke was intended to convey that he thought it was “bizarre” that Klansmen had smoked marijuana after one of their meetings.

“All of us understood that the Klan is a force for hatred and bigotry and it just could not have meant anything else than that under those circumstances,” Sessions said, noting that he had been involved in the decision to try one of the killers in state court so he could face the death penalty.

Sessions’ spokesman said the senator was unavailable to be interviewed for this story.

Barry Kowalski, a former Justice Department attorney who was in Mobile, working with Sessions on the Donald case, said he was there for the so-called joke about the Klan, and he did not interpret it as a racist comment. He said it was a joke. “That was totally hospital room humor,” Kowalski told the AP Thursday.

“I can only speak from what I saw,” Kowalski said. “He couldn’t have been more supportive of making sure we got convicted the murderers of the last black man who was lynched by the Klan.”

Gerry Hebert, another former Justice Department attorney who had worked with Sessions in the early 1980s, told the Judiciary committee about racist comments Sessions made regarding the NAACP being un-American and said Sessions agreed with another person’s comment that a prominent white civil rights lawyer was a disgrace to his race for trying voting rights cases.

“I filed all these things away thinking, ‘God, what a racist this guy is,’” Hebert told The Associated Press.

During Sessions’ confirmation hearing, then-Sen. Joe Biden asked Hebert if he would be comfortable trying a voting rights case before Sessions as a judge or whether he would ask that Sessions be recused because of racist comments he had made. “I would certainly raise the issue, absolutely,” Hebert responded.

Most of the senators who voted against Sessions in 1986 are no longer alive or in office. Vermont Democrat Patrick Leahy is the only one who voted against him still in the Senate.

Today, Sessions would face confirmation as a member of the chamber. Senators often are deferential to current and former members who are nominated for Cabinet posts. The last time the Senate rejected one of its own was in 1989 when then-Sen. John G. Tower, a Texas Republican, could not get confirmed as President George H. W. Bush’s defense secretary amid reports of heavy drinking and womanizing.

Sessions’ confirmation hearing could take place as early as January. The Republicans will have only a 52-48 advantage, assuming Republicans win an upcoming Senate election. That means Sessions can’t afford to lose any votes from members of his own party. If there are Republicans upset by his comments - not just years ago about race but also what he has said in recent years about immigration - his confirmation could be a challenge.

Sessions is an immigration hard-liner, not in step with mainstream Republicans. In the past year, he has supported mass deportations for immigrants in the country illegally, suggested that the administration quickly deport unaccompanied children and families who have been caught crossing the border illegally, linked terror attacks against the U.S. to Muslim immigrant families and complained that the Obama administration has increased the number of green cards issued to immigrants from “Muslim-majority countries.”

But South Carolina Republican Sen. Lindsey Graham said he would support a Sessions nomination.

“I’d vote for him. I like Jeff. He was the early, only supporter for Donald Trump in the Senate,” Graham said. “And I believe Jeff Sessions has earned the right to serve President Trump in the highest levels, and I think he’s a good, competent, capable man.”

Sen. Mike Lee, R-Utah, would also support Sessions, spokesman Conn Carroll said. “Sen. Lee has worked closely with Sessions in the Senate and has the utmost respect for his abilities,” Carroll said.

Sessions was asked by reporters at Trump Tower Thursday whether he thought he would be confirmed by the Senate.

“People have to make that decision. The actual senators will cast those votes on any confirmation,” Sessions said.

Sen. Dianne Feinstein, D-California, who was just elected as the next ranking member on the Judiciary Committee, said in a statement Friday that she is “committed to a full and fair progress” when lawmakers debate Sessions’ nomination as attorney general next year.

“While many of us have worked with Senator Sessions closely and know him to be a staunch advocate for his beliefs, the process will remain the same: a fair and complete review of the nominee,” Feinstein wrote.

She added that the attorney general should be “above the political fray,” is the person who has jurisdiction over many crucial laws and is in charge of overseeing immigration judges who will hear cases on applying for asylum status.