Updated

U.S. Sen. Jeff Flake, R-Ariz., facing a tough primary fight, announced Tuesday he will not seek re-election next year -- while taking a parting shot on the Senate floor at President Donald Trump for behavior he called "reckless, outrageous, and undignified."

Without mentioning the president by name, Flake accused the Republican Party of having "given in or given up on the core principles in favor of a more viscerally satisfying anger and resentment ... but anger and resentment are not a governing philosophy."

Flake has had a tumultuous relationship with the Trump administration. In August, he criticized the president's immigration policy in a New York Times opinion piece. The president tweeted in response that Flake was "WEAK on borders, crime and a non-factor in the Senate."

Flake, 54, was elected to the Senate in 2012 after 12 years in the House of Representatives. But polls showed him trailing primary challenger Kelli Ward, a former state senator who is backed by former White House chief strategist Steve Bannon.

White House press secretary Sarah Huckabee Sanders said Tuesday that "based on [Flake's] previous statements and the lack of support he has in Arizona," his decision not to seek re-election "is probably a good move." Sanders added that "a lot of the language [in Flake's speech] was not befitting of the Senate floor."

Ward tweeted after Flake's announcement, "Arizona voters are the big winner in @JeffFlake's decision to not seek reelection. They deserve a strong, conservative in the Senate... who supports @POTUS & the 'America First' agenda."

But Flake suggested primary voters were turning away from "traditional" conservatives.

"It is clear at this moment that a traditional conservative who believes in limited government and free markets, who is devoted to free trade, who is pro-immigration, has a narrower and narrower path to nomination in the Republican Party," said Flake, whose voice occasionally trembled with emotion.

"The notion that one should stay silent as the norms and values that keep America strong are undermined," Flake added, "and as the alliances and agreements that ensure the stability of the entire world are routinely threatened by the level of thought that goes into 140 characters ... is historic and, I believe, profoundly misguided."

Flake's speech was greeted with applause in the Senate chamber. His fellow Arizonan, Sen. John McCain, tweeted thanks to Flake for his "honorable service to the state of Arizona & the nation."

Senate Minority Leader Chuck Schumer, D-N.Y., praised Flake in a statement, calling him "one of the finest human beings I've met in politics.

"He is moral, upright, and strong and he will be missed by just about everybody in the Senate," Schumer added.

Senate Majority Leader Mitch McConnell, R-Ky., praised Flake as "a great team player" who is "always trying to get a constructive outcome no matter what the issue before us.

"So I thank the Senator from Arizona for his service which will continue, thankfully, another year and a half, and for the opportunity to listen to his remarks today," McConnell added.

President Trump's eldest son, Donald Jr., tweeted a link to an Arizona Republic story announcing Flake would not run for re-election with the hashtag "#MAGA."

Flake's announcement came a month after another prominent Republican senator, Bob Corker of Tennessee, announced he would not seek re-election next year. Corker and Trump have since engaged in a war of words, with the president calling the senator "incompetent" and "liddle Bob Corker" in a series of Tweets Tuesday morning.

Corker fired back, calling the president "utterly untruthful" on Twitter, and telling Fox News that Trump's "political model ... is to divide."

"The voters of these individual senators’ states were speaking at pretty loud volumes," Sanders said of Corker and Flake. "I don’t think they were likely to be re-elected, and I think that shows their [states'] support is more behind the president than those two individuals."

Besides Ward, other potential candidates for Flake's seat include current state university regent Jay Heiler, former state GOP chairman Robert Graham, and state treasurer and 2016 Trump campaign CFO Jeff DeWit. Other names that have been floated in recent weeks include Reps. Paul Gosar and Trent Franks, conservative stalwarts who sit in safe GOP seats.

Heiler announced early this month that he was considering a run. He was chief of staff to Arizona Gov. Fife Symington in the 1990s and has been involved in numerous political campaigns.

Former Arizona Gov. Jan Brewer was pushing Heiler as a candidate.

"I've known Jeff for a long time and I admire him for his service that he has given to our state," she said Friday. "But I believe it is an opportunity for me to support a different candidate, someone that I've known for a long while, and somebody that I believe will serve Arizona the best."

On Tuesday, she tweeted: "The 2018 Senate race about to get real interesting!"

Fox News' Brooke Singman and the Associated Press contributed to this report.