“It is often said that children are watching,” he said. “Well, they are. And what are we going to do about that? When the next generation asks us, ‘Why didn’t you do something? Why didn’t you speak up?’ What are we going to say?”
Without mentioning Mr. Trump by name, Mr. Flake, 54, took direct aim at the president’s policies, notably his isolationist tendencies, but also his behavior and that of his aides. In his time in Washington, Mr. Flake embodied an old-line conservatism. He avidly pitched smaller government, spending cuts and an end to home-district pork-barrel projects, but also supported free trade, engagement with the world and an openness to immigration.
Those positions stood in marked contrast to Mr. Trump’s inward-looking, anti-immigration nationalism. The senator had already touched on such themes in a book he published in August, “Conscience of a Conservative,” that was highly critical of the president. In his speech, he was at turns somber and passionate.
“We must stop pretending that the degradation of our politics and the conduct of some in our executive branch are normal,” Mr. Flake said. “They are not normal. Reckless, outrageous and undignified behavior has become excused and countenanced as telling it like it is when it is actually just reckless, outrageous and undignified. And when such behavior emanates from the top of our government, it is something else. It is dangerous to a democracy.”
As he spoke, Senator Mitch McConnell, the majority leader, Mr. McCain and Mr. Corker sat listening on the Senate floor. Mr. Corker had jousted with the president only hours before.
“Isn’t it sad that lightweight Senator Bob Corker, who couldn’t get re-elected in the Great State of Tennessee, will now fight Tax Cuts plus!” Mr. Trump wrote on Twitter on Tuesday morning, fearing that Mr. Corker’s vow to oppose any tax plan that increases the federal debt could imperil his tax push.
Mr. Corker snapped back, “Same untruths from an utterly untruthful president.”
“I don’t know why he lowers himself to such a low, low standard and is debasing our country,” Mr. Corker said in a CNN interview, suggesting that he would soon convene hearings to examine the ways Mr. Trump “purposely has been breaking down relationships around the world.”
“It’s unfortunate that our nation finds itself in this place,” he added.
After the speech, Mr. McConnell praised Mr. Flake and said he regretted the senator’s decision to leave. “We have just witnessed a speech from a very fine man, a man who clearly brings high principles to the office every day,” the leader said.
But privately, some Republicans were growing angry at the displays of disunity from Senators Flake and Corker as the party was trying to come together to pass a major overhaul of the tax code. Only minutes before Mr. Flake’s address, the president had been in the Capitol for lunch with Senate Republicans and a discussion about tax reform.
The announcement did please Republican officials in Arizona and Washington, who believe that they now have a better chance at retaining the seat.
Mr. Flake’s private polling had steadily become worse this year as he intensified his criticism of Mr. Trump. His firm stand against the president had alienated Republican voters, but his long, conservative track record dissuaded Democratic voters in the state from coming to his side. One poll showed he had just an 18 percent approval rating among Arizona residents, and a survey that the senator conducted last month led some of his own allies to conclude that he could not win a Republican primary, according to multiple officials directly familiar with the situation in the weeks leading up to Tuesday’s speech.
Sarah Huckabee Sanders, the White House press secretary, said that she had not spoken with Mr. Trump about the senator’s decision but that she was not lamenting the announcement.
“Based on previous statements and certainly based on the lack of support that he has from the people of Arizona, it’s probably a good move,” she said.
She said history would remember Mr. Trump for his achievements and the strong economy that he was presiding over, “not some petty comments from Senator Corker and Senator Flake.”
At home in Arizona, Mr. Flake was facing threats from both the right and the left. His main primary challenger, Kelli Ward, an osteopathic physician and a former state senator who ran unsuccessfully against Mr. McCain last year, kicked off her campaign last week with two conservative luminaries — Laura Ingraham, the radio host, and Stephen K. Bannon, Mr. Trump’s former chief strategist — at her side.
“Steve Bannon adds another scalp to his collection,” said Andy Surabian, a senior adviser to the Great America Alliance, a Bannon-aligned group that has endorsed Ms. Ward. “This is a direct result of the political pressure put on Jeff Flake over the last several months.”
On Tuesday, Breitbart News, the website that Mr. Bannon oversees, reported his reaction to Mr. Flake’s announcement as defiant: “Our movement will defeat you in primaries or force you to retire.”
Now, a race that had been expected to fall along familiar establishment-versus-insurgent lines, with Mr. Flake pitted against Ms. Ward, has been blown wide open. Mainstream Republicans believe that Ms. Ward will be overwhelmed by a flood of other candidates. Representative Paul Gosar, a conservative firebrand, and former Gov. Jan Brewer, for example, could enter the race.
But there is considerable uncertainty among establishment Republicans, too. Most party leaders suggest Representative Martha McSally, a former Air Force pilot, would be their most formidable contender to take on Representative Kyrsten Sinema, the likely Democratic nominee. But some Republicans privately say the safer course is for Ms. McSally is to wait for the ailing Mr. McCain to vacate the seat and eventually ascend to the Senate via appointment.
To many conservatives who support Mr. Trump, Mr. Flake was an especially desirable target. Few in the Senate had spoken more candidly about their misgivings with Mr. Trump, first as a candidate and then as president. He had particularly elicited conservatives’ ire with his book, in which he equated Republicans’ acceptance of Mr. Trump as their nominee to a Faustian bargain.
Mr. Trump himself encouraged a primary challenge to Mr. Flake, calling him “a non-factor” and “WEAK on borders,” while lauding Ms. Ward on Twitter.
What Mr. Flake’s retirement made clear, though, was something potentially much more significant than an individual senator’s standing in the angry and restless conservative movement. It suggested that under Mr. Trump, the Republican Party has little room for voices that dissent from the president’s crass style of politics and his polarizing agenda.
Mr. Flake’s decision to step down was, in a sense, a tacit admission that crossing the president had put him in political peril. But in an interview in Phoenix this month, he said he had no regrets and always knew that crossing the president would be dangerous politically. He reiterated that sentiment on the Senate floor on Tuesday.
“We’re not here to simply mark time,” the senator said. “Sustained incumbency is certainly not the point of seeking office, and there are times when we must risk our careers in favor of our principles. Now is such a time.”