Rep. Martha McSally (R-Ariz.) is confronting the complexities of immigration as she runs for a U.S. Senate seat. (Matt York/Associated Press)

The prized Republican Senate recruit in this increasingly competitive state was getting ready to take her place in the annual Frontier Days parade, and she was defiant.

Rep. Martha McSally blamed Congress and not the White House for separations of families at the border, dismissed as “fake news” her visible shift to the right on immigration and lashed out at her leading Democratic opponent over “sanctuary cities.”

The comments by the two-term congresswoman from southern Arizona, which came in an interview before a morning of flag waving and handshaking, echoed a man she once found appalling and may have voted against: President Trump.

Her transformation is one Republicans across the country have been forced to make, but a growing number of McSally supporters worry she is sprinting too far to the right on immigration for this rapidly diversifying state, which Democrats are eager to turn blue this year.

“I am personally troubled by her position on immigration,” said Yasser Sanchez, a Republican immigration attorney who was thrilled when McSally first entered the race to replace the retiring Republican Jeff Flake. “You don’t want to alienate the president to the point that he’s tweeting against you. But at the same time, you have to be careful. It’s just that tough balance.”

In few other midterm battlegrounds is the tightrope thinner or the stakes higher than Arizona’s Senate race. Both parties see it as critical to winning control of the Senate.

It is unfolding as the state and the country grapple with undocumented immigrant family separations, which Trump has halted but not resolved. More than 300 children separated from their families at the border were being held in Arizona, the governor’s office confirmed last week.

McSally made history in the Air Force as the country’s first female fighter pilot to fly in combat, and she has made clear her desire to run on her military credentials. Along the parade route, her supporters wore shirts proclaiming “Fly. Fight. Win.”

Yet she has had little choice but to adapt to her new posture. Immigration has long been a litmus test in statewide Republican primaries in Arizona, and the pressure to be a hard-liner has only increased in the Trump era.

Moreover, McSally faces two Republican challengers — osteopath Kelli Ward, a former state senator who described as “humane” the Trump “zero tolerance” immigration policy that triggered the separations, and former Maricopa County sheriff Joe Arpaio, who cracked down on those he believed to be undocumented immigrants. Arpaio was convicted of criminal contempt for violating a judge’s order about his detention policies but was pardoned by Trump.

“I think that she’s evolved and she understands that this is a huge, huge issue,” said former Arizona governor Jan Brewer, a Republican and McSally supporter. Brewer signed a bill as governor empowering police to question anyone they reasonably suspected of being undocumented. (The measure was later dismantled by a court challenge and legal settlement.)

McSally is not the first Arizona Republican to have felt the election-year tug of the conservative base. In 2010, Sen. John McCain distanced himself from his past support for making moderate changes to immigration policy by airing an ad in which he strode along the border and famously insisted it was time to “complete the danged fence.”

But the state is now more than 30 percent Hispanic and increasingly younger, and Trump only narrowly defeated Hillary Clinton in Arizona in 2016.

“I think she needs to be careful not to go too far,” said Mesa Mayor John Giles, a Republican who backs McSally.

McSally was elected to Congress in 2014 in a district that stretches southeast from Tucson to the Mexican border, and which went narrowly for Hillary Clinton in 2016. She joined the Senate race in January, exciting party leaders eager for her to run.

The congresswoman spent a recent Saturday campaigning in Prescott, a conservative mountain city with saloons, old brick buildings and a famous rodeo. Under a sunny sky, she wove through the historical downtown in an American flag T-shirt that said “Made in America 2018,” giving out handshakes and hugs and paying tribute to veterans in the crowd.

“West Point!” she said excitedly to one man, spotting it on his shirt. “Thanks for serving.”

“That’s my grandson, but I did serve!” he replied.

But immigration, not McSally’s military service, remains the dominant issue in the Aug. 28 Republican primary; its August arrival leaves little time for a general election pivot.

In May, McSally removed herself as a co-sponsor of a bill that offered a path to citizenship for certain young undocumented immigrants. In June, a video of her talking sympathetically about young undocumented immigrants was removed from her congressional website.

McSally denies any shift. In the interview, she said she pulled her support from the bill in May to make clear her opposition to legislation strictly to protect the young undocumented immigrants. She said she wanted to address the “root causes” of their population at the same time.

Ward, running to McSally’s right, has accused McSally of changing her tune due to political expedience and called her a “cheap imitation” of Ward.

“I think the zero tolerance policy is one of the most humane things that we can do because we are creating a real deterrent for families who want to try to traipse across multiple countries to get here,” Ward said in an interview near the Yavapai County Courthouse, where Sen. Barry Goldwater (R-Ariz.) launched his campaign for president.

Ward, who aspires to be a “rolled up, all-into-one” version of Sens. Ted Cruz (R-Tex.), Rand Paul (R-Ky.) and Mike Lee (R-Utah), has struggled to gain momentum. She also walked in the Frontier Days parade — but with a noticeably smaller contingent.

Arpaio also has failed to impress many primary voters. He was not at the parade, an absence Ward noted with a suggestion that he was not up to the “grueling event.”

The presence of two challengers vying for the conservative vote would seem to increase the odds of a McSally win. But she is taking no chances as all three candidates run as staunch supporters of Trump’s agenda — the winning recipe in Republican primaries this year.

“I have a great relationship with the president. I’m working with him on the issues of the day. I’m over at the White House all the time,” McSally said.

She took a different tone in the past.

“I’m appalled,” she tweeted in 2016 after release of the “Access Hollywood” video in which Trump bragged about sexual assault. “This is ridiculous,” she said on MSNBC after Trump’s proposed travel ban for residents of several majority-Muslim countries. Nearly two years after the election, she will not say whether she voted for him.

“On a couple of occasions, I made some statements about specific things that were said. It was very measured compared to a lot of Republicans, by the way,” McSally said in the interview.

McSally is casting herself as the firewall protecting the GOP’s fragile 51-to-49 Senate majority from Democrats.

“The real fight out there right now is ensuring that we keep this seat,” McSally said. “There will be no chance for them to flip the Senate if I hold onto this seat in the general election.”

The probable Democratic nominee is Rep. Kyrsten Sinema, who has undertaken a transformation of her own. Once attached to the liberal Green Party, Sinema has moved to the center over the years. She is a strong fundraiser and polls have shown her leading the Republican candidates.

“This crisis of families being separated on the border did not need to happen,” Sinema said at an event at a senior-living community in Tempe on Monday. “This was a choice that the administration made.”

McSally said she looked forward to contrasting her record on border security and immigration with that of Sinema, whom she argued has not been tough enough. But if she wins the primary, McSally may have to placate both ends of the GOP spectrum.

From the right, Ward would not commit to supporting the nominee if she doesn’t win. And further left, Sanchez, the Republican immigration attorney, said McSally’s posture has given him pause about campaigning for her with the same vigor as he did for McCain, for whom he turned his office into a phone-banking center.

“I do not see myself showing the same amount of support,” he said.