MOBILE, Ala. — Jeff Sessions, the former attorney general who emerged from political exile and defied President Trump to run for the United States Senate from Alabama, was locked in a competitive fight on Tuesday to win back the seat he held for 20 years.
Most precincts across the state were still counting votes. But Mr. Sessions was fighting off strong challenges from two Republicans who attacked him in a relentlessly negative and personal campaign that turned into a test of loyalty to the president. Mr. Sessions, who has been leading in public polls but short of a majority, did not appear likely to clear the 50 percent threshold he needs to avoid a runoff election, people close to his and rival campaigns said.
Competing to run against Mr. Sessions in a runoff were Tommy Tuberville, a former Auburn University football coach and political neophyte, and Bradley Byrne, a congressman from the Mobile area who tried to overcome his long association with the Republican Party establishment by tethering himself to Mr. Trump.
Voters in Alabama, Texas and North Carolina, where Democrats on Tuesday picked a candidate to challenge a vulnerable Republican, Senator Thom Tillis, were setting up the bigger battle for control of the Senate in 2020. Cal Cunningham, an Army veteran and former state legislator, won the Democratic nod to run against Mr. Tillis in what is expected to be one of the country’s most fiercely contested Senate races.
The winner on the Republican side in Alabama will face Senator Doug Jones, who is widely viewed as the most endangered Democrat up for re-election in the Senate this year. Whoever wins the Republican nomination is expected to have a significant advantage over Mr. Jones in deeply red Alabama, which Mr. Trump carried with 61 percent of the vote.
If Republicans do win the seat, it will provide them some breathing room in what is expected to be an otherwise difficult year to defend their 53-47 majority, with an unpopular incumbent president on the ticket and concern that Republican senators from Maine to Colorado are in jeopardy. With the vice president empowered to cast tiebreaking votes in the Senate, Democrats need a net gain of three seats to take the majority if the party captures the White House; four if not.
The primary in Alabama was a humbling experience for Mr. Sessions, who was treated as a castoff by the Republican Party he helped transform by championing a more nationalistic, anti-immigration, anti-free trade agenda years before Mr. Trump ran for office sounding those themes. Mr. Sessions’s predicament became a cautionary tale about the grudges and grievances that are at the heart of Mr. Trump’s politics. And it left little doubt about how successful Mr. Trump has been at turning his party into a vessel for his own political advancement, where the fundamental organizing principle is not conservative ideology or policy, but personal loyalty to him.
Mr. Sessions’s failure to make a stronger showing on Tuesday was a striking reversal of fortune for a politician whose standing in Alabama was once so formidable that the last time he ran for re-election in Alabama, the Democratic Party did not even bother to nominate a candidate to oppose him.
His problem this time was that not enough Republican voters appeared to recall the pre-Trump Jeff Sessions, a beloved figure on the right who helped fuel a populist backlash that antagonized Republican leaders over the very issues that are now at the heart of Mr. Trump’s nationalist agenda.
Instead, many of them saw the diminished attorney general who had been harangued, humiliated and belittled by Mr. Trump, who attacked Mr. Sessions as “scared stiff” and “Missing in Action” and told NBC News that appointing him was his “biggest mistake” he had made as president.
Likely helping Mr. Sessions hang on was the fact that Mr. Trump largely stayed silent once Mr. Sessions announced his campaign — an uncharacteristic show of restraint for a president who can rarely resist the urge to dive into races across the country, and can change their outcome with a single caustic tweet. His advisers and Republican leaders pleaded him not to interfere in the Alabama race even though his hostility toward his former attorney general still burns hot.
More often when voters turn away from a politician with a long record and a reservoir of good will, legal or ethical wrongdoing or a personal scandal has left them sour. In Mr. Sessions’s case, the opposite was true. Legal scholars and Justice Department lawyers agreed that he properly recused himself from overseeing the investigation into possible ties between Russia and the 2016 Trump campaign because he had been a close adviser to Mr. Trump during the election.
But in the eyes of Mr. Trump and his supporters — and the campaign message of Mr. Sessions’s primary opponents — the former attorney general’s offense was that he had not done enough to protect the president. The ethics of the recusal, as far as they were concerned, were either irrelevant or misrepresented by enemies of the president.
Even before Mr. Sessions announced that he would run in November, the primary was dominated by effusive demonstrations of support for Mr. Trump. The candidates rarely saw an issue they did not try to use as a way to prove their fealty to the president. As the House of Representatives prepared to impeach the president in October, Mr. Byrne was one of several Republicans who barged into a closed Intelligence Committee meeting and started shouting at Representative Adam B. Schiff, the chairman and a leader of the Democratic impeachment effort.
Mr. Tuberville campaigned across the state saying that his biggest reason for wanting to serve in Washington was “to help Donald Trump.” In his first television ad, he declared that the president was a gift from the divine. “God sent us Donald Trump because God knew we were in trouble,” he says, promising to go to Washington to help build the Trump border wall and drain the proverbial swamp.
Mr. Sessions’s assumption going into the race was that his decades of service in Alabama — he was first elected to the Senate in 1996 and served as state attorney general for two years before that — would help him overcome any stain on his reputation from his falling out with the president. On the campaign trail, he played the role of the seasoned pragmatist who would defend the Trump agenda because he understood and valued it better than anyone.
He also tried to remind Alabamians that despite his troubled relationship with the president, he had been an early supporter of Mr. Trump’s when “only one senator had the guts to support him,” as one of Mr. Sessions’s recent ads put it.
In North Carolina, Mr. Cunningham, a moderate favored by party leaders in Washington, was on track to handily beat Erica D. Smith, a Democratic state senator running to his left in the primary. But the victory did not come cheaply: His campaign and outside Democratic groups spent more than $10 million boosting his candidacy. And in a sign of how concerned Republicans are about losing the seat, they quietly funneled close to $3 million into the race on Ms. Smith’s behalf to make Mr. Cunningham’s path more difficult.
Nicholas Fandos contributed reporting from Washington.