Arizona Sen. Jeff Flake announced Tuesday he won't seek re-election in 2018 after facing withering attacks from President Trump.

Flake confirmed his decision in a Senate floor speech, and condemned the current state of politics as one of the main reasons he's deciding to step aside.

"It must also be said that I rise today with no small measure of regret," Flake said on the Senate floor. "Regret because of the state of our disunion, regret because of the disrepair and destructiveness of our politics, regret because of indecency of our discourse, regret because of the leadership, regret because of the compromise of our morale authority and by all, I mean all of our, complicity in this state of our affairs. It is time for that to end."

Flake served seven terms in the House before running successfully for his Senate seat in 2012. His term will end at the end of 2018.

Flake first announced his decision in an interview with the Arizona Republic, during which the senator said he decided "there may not be a place for a Republican like me in the current Republican climate or the current Republican Party."

"Here's the bottom line: The path that I would have to travel to get the Republican nomination is a path I'm not willing to take, and that I can't in good conscience take," Flake told the Arizona Republic. "It would require me to believe in positions I don't hold on such issues as trade and immigration, and it would require me to condone behavior that I cannot condone."

He echoed that sentiment during his speech on the Senate floor, where here was joined by number of his Republican colleagues, including Senate Majority Leader Mitch McConnell, and Sens. Bob Corker of Tennessee, John McCain of Arizona, John Barrasso of Wyoming, and Ben Sasse of Nebraska.

"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, the party that has so long defined itself by its belief in those things," Flake said. "It is also clear to me for the moment that we have given in or given up on the core principles in favor of a more viscerally satisfying anger and resentment. To be clear, the anger and resentment that the people feel at the royal mess that we've created are justified. But anger and resentment are not the governing philosophy."

Flake, who was first elected in 2012, has gone head-to-head with Trump this year, and was attacked by the president frequently on Twitter after he published a book critical of Republicans for embracing Trump.

Trump called Flake "weak" on crime and immigration, and signaled support for Kelli Ward, who planned to challenge Flake in the Republican primary for his seat.

"Great to see that Dr. Kelli Ward is running against Flake Jeff Flake, who is WEAK on borders, crime and a non-factor in Senate. He's toxic," Trump tweeted in August.

Flake spent much of his speech on the floor of the Senate Tuesday ripping Trump and urging people to not see his behavior as normal.

"None of these appalling features of our current politics should ever be regarded as normal. We must never allow ourselves to lapse into thinking that that is just the way things are now," Flake said. "If we simply become inured to condition, thinking that it is just politics as usual, then heaven help us. Without fear of the consequences and without consideration of the rules of what is politically safe, we must stop pretending that the conduct of some in our executive branch are normal. They are not normal."

Flake added he made his decision so he could try and put a stop to the coarseness Trump has introduced to American politics.

"Reckless, outrageous and undignified behavior has been excused as telling it like it is when it is actually reckless, outrageous and undignified," Flake said. "When such behavior emanates from the top of our government, it is something else. It is dangerous to a democracy. Such behavior does not project strength because our strength comes from our values. It, instead, projects a corruption of the spirit and weakness. It is often said children are watching. 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?"

"I will not be complicit or silent," he added, saying political considerations are keeping him from properly serving his country.

The Arizona senator lamented that a unit of the GOP has "complete and unquestionable loyalty" to Trump, which he called "unacceptable and suspect," and said he believes he had an obligation to speak out against the president's behavior, particularly as Trump has challenged the "norms and values that keep America strong."

"I'm aware there's a segment of my party that anything short of complete and unquestionable loyalty to a president who belongs to my party is unacceptable and suspect. If I have been critical it is not because I relish criticizing the behavior of the president of the United States. If I have been critical, it is because I believe it is my obligation to do so, and as a matter and duty of conscience," he said. "The notion that one should stay silent as the norms and values that keep America strong are undermined and the alliance are routinely threatened by the level of thought that goes into 140 characters. The notion that we should say or do nothing in the face of such is misguided."

The winner of next year's Republican primary in Arizona could be up against Democratic Rep. Kyrsten Sinema, who announced in September she would try to unseat Flake.

Flake's Republican colleagues reacted with sadness to the news of his retirement.

Sen. John McCain, R-Ariz., said he hoped Flake wasn't going to go through with his plans.

"I knew he was thinking about it, but I'm very sorry it's happening," McCain said. "He's one of the most honorable men I've ever known."

"Terrible," Sen. Tim Scott, R-S.C., added. "He's a good man and one of the better guys in the Senate, wish he was sticking around."

Reporter Laura Barron-Lopez contribued to this story.