Establishment Republicans have grown increasingly confident that their top Senate recruit will survive Tuesday’s bruising Arizona primary, just weeks after they panicked and pleaded with President Trump to take sides.

Party leaders expect Rep. Martha McSally, a former Air Force pilot, to prevail over insurgent conservative Kelli Ward and former Maricopa County sheriff Joe Arpaio, who is one of Trump’s strongest supporters.

Still, some in the GOP have lingering concerns that McSally will lose and force the party to all but surrender a seat they have controlled for more than two decades, an outcome that would deal a significant blow to the party’s midterm election hopes of keeping the Senate majority.

Others worry that McSally will begin the general election weakened from an expensive primary that has forced her to tack to the right in a state where demographic changes have opened the door for Democrats.

Looming over it all is Trump, who has stayed out of the race despite pressure for him to back McSally. Trump is not expected to make an 11th-hour endorsement, according to a White House official who said the primary is complicated for the president.

Trump has personal connections to Ward and Arpaio, while McSally has been a Trump critic who has declined to say whether she voted for him in 2016. The president is aware of McSally’s criticism, said the official, who spoke on the condition of anonymity to describe private talks.

Nevertheless, McSally and her strategists are confident that they weathered a rough patch a few weeks ago when Ward surged in the race. Looking toward November, McSally unveiled a TV ad Thursday highlighting her military service and the security threats the nation faces and criticizing the likely Democratic nominee, Rep. Kyrsten Sinema, for “protesting us in a pink tutu.”

A Sinema spokesman dismissed the ad as a commercial from a struggling candidate.

In an interview this week, McSally said “we are now still in a commanding lead.”

Tuesday’s vote marks the last big hurdle for Senate Republicans to clear this primary season as they pick a nominee for the seat being left open by Republican Jeff Flake’s retirement.

After a special-election loss by Roy Moore in Alabama last year, Republicans have avoided choosing candidates who would struggle to win in a general election, picking more mainstream hopefuls in must-win states.

Republicans are defending a slim 51-to-49 Senate majority against the head winds of an unpopular presidency. Although most seats up for grabs are in conservative states, foreboding historical trends during a president’s first midterm have compounded their concerns.

A McSally defeat would be a major blow to the party’s chances in November, because Arpaio and Ward have been awash in controversy. Arpaio has campaigned this week with Courtland Sykes, who has said feminists have “snake-filled heads.” Ward is teaming up later this week with Mike Cernovich, who spread the “Pizzagate” conspiracy theory.

McSally has drawn harsh criticism from Arpaio and Ward.

Ward seized on the death of a 20-year-old college student in Iowa, where authorities say the suspect was an immigrant from Mexico in the country illegally, to assail McSally along with Arizona’s two senators.

“The lack of leadership & courage by open border senators like @JeffFlake, @SenJohnMcCain, & #amnesty advocate Martha McSally contribute to these senseless deaths,” Ward tweeted. “We need true leadership in the Senate to #BuildTheWall & secure our borders! #VoteWard #AZSEN.”

Arpaio dismissed McSally and Ward.

“I would love to run against a Republican for a change,” Arpaio said in an interview. “I am running against a nice lady named McSally. I don’t know what she is. She sounds like a Democrat. I am running against another nice lady that sounds like a Libertarian.”

Some McSally supporters remain nervous that the broadsides against the congresswoman, who was an outspoken Trump critic toward the end of the 2016 campaign, could cause her to lose.

“I think a lot of the establishment is very nervous, and it’s way too close for comfort,” said Dan Eberhart, a McSally donor.

Like most Republican primaries this year, the contest has largely been a battle to demonstrate the most loyalty to Trump. Ward has distributed campaign fliers of a photo she took with him. Arpaio, who received a pardon from Trump, has focused on his relationship with the president. “All I can say about the president is that we have known each other a long time,” he said.

During the primary race, McSally has had nothing but nice words for Trump. Her campaign has been promoting a video clip of Trump praising her at a recent defense-bill signing, though he stopped short of an endorsement. “I was honored for his words,” she said. “It was a very strong shout-out.”

There had been a push among some McSally supporters for a Trump endorsement weeks ago. The chairman of the National Republican Senatorial Committee, Sen. Cory Gardner (Colo.), asked Trump to back McSally, according to people familiar with the conversation.

For Trump, picking McSally would mean siding against Arpaio, an immigration hard-liner who Trump pardoned last year after he was convicted of criminal contempt for violating a federal judge’s order related to his detention policies. It would also mean opposing Ward, whom he has praised in the past.

Senate leaders are not holding their breath for an endorsement. “I don’t know nor do I particularly expect the president to weigh in,” said Majority Leader Mitch McConnell (R-Ky.), who prefers McSally.

A White House spokesman did not respond to a request for comment on the president’s plans.

A few weeks back, McSally’s strategists and allies detected that Ward was gaining some steam. They attributed some of it to a Democratic group that organized and quickly started attacking McSally.

The organization, called Red and Gold, which refer to colors on the Arizona flag, formed in early August and has spent more than $1.6 million on ads criticizing McSally, federal campaign finance filings show. The group has ties to Washington-based Democratic firms. Its donors will not be known publicly until after the primary.

The open-seat scramble was triggered when Flake, one of the most vocal Trump critics in the Republican Party, announced that he would retire. Flake is among those sounding alarms about his party’s chances of holding the seat in November.

Flake predicted the GOP rush to embrace Trump will eventually be seen as “a low moment for the party.” He expressed concerns about the eventual nominee’s readiness to face Sinema, a talented fundraiser who has been running as a consensus builder.

Arizona has voted Republican in the past five presidential elections. But Trump’s narrow, three-percentage-point win emboldened Democrats looking to turn the state blue. Some Republicans warn that the party needs to adopt a more moderate tone or risk defeat in future elections.

McSally allies have long felt that the three-way primary would work in her favor, by splintering the vote of those opposed to her candidacy. Limited public polling has shown McSally leading.

Early voting is popular in Arizona, which means much of the primary is already being decided. As some McSally supporters sweat out the final days, she is already looking ahead to the next time voters will go to the polls.

“Victory is in 77 days and eight hours and 10 minutes,” McSally said. “That’s when the general election is over.”

Michael Scherer and Seung Min Kim contributed to this report.