Republican Rep. Martha McSally is backing President Trump and his agenda in her bid to keep an Arizona Senate seat for Republicans -- shifting course from 2016 when she refused to endorse Trump’s presidential campaign.

"You better believe I will keep working with President Trump," McSally, a former fighter pilot, said Friday in officially announcing her candidacy.

Beyond failing to endorse Trump’s candidacy, McSally has also been critical of Trump’s words and actions during the first year of his presidency.

But she has also voted with Trump, a fellow Republican, nearly 97 percent of the time. GOP Sen. Jeff Flake, who now holds the seat, decided in October not to seek re-election amid his vocal opposition to Trump, in a state that gave Trump 49 percent of the vote in 2016.

Democrats have eyed the seat since Flake announced his retirement, in their bid this year to eliminate Republicans’ 51-49 Senate majority and take control of the chamber.

They have a top-tier candidate in Rep. Kyrsten Sinema. But their hopes for an expensive and politically damaging GOP primary appears slightly dashed now that McSally is officially in the race and with Trump.

Trump has made no official statement since McSally made the announcement. However, McSally will likely become the favored candidate among Washington Republicans, over Kelli Ward and former Sheriff Joe Arpaio, both Trump supporters but candidates whose political views are less mainstream to voters.

Republicans lost a Senate seat last month to Democrats in Alabama after Trump and other Washington Republicans in the state's GOP primary backed conservative firebrand Roy Moore over the more moderate Luther Strange.

The 51-year-old McSally on Friday also said young illegal immigrants, or DREAMers, shouldn't be shielded from deportation unless Democrats agree to build Trump's massive border wall.

She doesn't even mind if Trump described Haiti and other African nations with vulgar language earlier in the week.

"I speak a little salty behind closed doors at times as well, so I'm not going to throw the first stone on using any language," she said.

She’s betting big that she needs Trump's most passionate supporters on her side if she's to keep Flake's seat in Republican hands.

McSally is embracing Trump and his political playbook -- which emphasizes the dangers of illegal immigration and demands border security above all else -- in a state where nearly one in three residents is Hispanic and roughly one million are eligible to vote, according to the Pew Research Center.

The success of her message will help determine whether it's finally time for Republican candidates to heed party leaders who warned six years ago that candidates must soften their tone on immigration and do far more to connect with Hispanic voters and other minorities.

In announcing her candidacy on Friday, at least, McSally is showing no sign of moderating her tone.

"When facing vicious cartels and the possibility of terrorists, a secure border is not just the people's right, it is the federal government's urgent responsibility," she told dozens of people gathered for her announcement speech in a Tucson aircraft hangar. "There should be no sanctuary for anyone breaking our laws and harming our people."

The 85-year-old Arpaio is a nationally known immigration hardliner pardoned by Trump last year after defying a judge's order to stop traffic patrols that targeted immigrants.

Ward is a former state senator and an early favorite of former Trump adviser Steve Bannon.

"She obviously has a primary where immigration will play a big role," Republican strategist Alex Conant said of McSally. "Trump's position on immigration is where the base of the party is. You cannot be perceived as being soft on illegal immigration and expect to hold the base."

Trump won the presidency by adopting aggressively anti-immigrant language that continues to spark accusations of racism and bigotry.

In Arizona, McSally doesn't see any cause for concern with Trump's leadership.

"He's a fighter. He's a scrapper. He can't help it when he's attacked but to punch back. It is who he is," she said. "We're not going to change him. So why don't I focus on what I can do instead of focusing on what somebody else is doing?"

The Associated Press contributed to this report.