As one of the most conservative members of the Senate, Mr. Sessions has been a reliable voice for strict immigration enforcement, reduced spending and tough-on-crime measures. He is generally well liked among colleagues in both parties, and took a political risk endorsing Mr. Trump shortly after the South Carolina primary. His views on immigration and trade are aligned with the message that Mr. Trump conveyed during the race. Mr. Sessions has frequently traveled with Mr. Trump and was said at one point to be under consideration as the vice-presidential nominee.

Mr. Sessions has long considered it a personal triumph that he was elected to the Senate and became a member of the Judiciary Committee after that same panel rejected his nomination to the bench. Two Republicans joined Democrats in opposing his nomination. One of those Republicans, Senator Arlen Specter of Pennsylvania, later said his vote had been a mistake — a fact that Mr. Sessions likes to point out.

But Mr. Sessions’ 1986 hearings were unusually rancorous, both for the era and for the position he was seeking. The sessions stretched for hours as Justice Department officials were called to testify about their colleague’s views on race. Mr. Sessions said his comment about the Klan was meant as a joke and said it was so preposterous — especially since he was in the middle of prosecuting a case involving the group — that he thought nobody could take it seriously.

He was less clear about his remarks about civil rights groups. Asked whether he ever said the N.A.A.C.P. hates white people or was “a commie group and a pinko organization,” Mr. Sessions said he could not recall specifically saying that. “I am loose with my tongue on occasion, and I may have said something similar to that or could be interpreted to that,” he testified.

He went on to praise the N.A.A.C.P. for its work for racial equality in the South. He said he never called the group or the A.C.L.U. un-American, but added: “I said that they take positions that are considered un-American. They hurt themselves; they lose credibility. And many people do think that some of those positions they take are against the national interests of the United States.” He said he was referring to liberal immigration policies and support for the socialist Sandinista government in Nicaragua.