Sen. Jeff Flake (R-Ariz.) has been planning for a conservative primary challenger for several years, particularly after joining the unsuccessful 2013 bid to revamp immigration laws and create a path to citizenship for some undocumented immigrants.

Now, however, Flake finds himself battling not just conservatives in the August 2018 Republican primary but also the constant chatter that President Trump is out to knock him off because of their clashes during the 2016 campaign.

Potential rivals have been open about their discussions with White House officials over challenging Flake, including one meeting that involved the brother of White House chief strategist Stephen K. Bannon.

The moves have angered senior Republicans, especially because antagonizing any senator is not smart when leaders need every possible vote to resuscitate the floundering health-care proposal and pursue the rest of the GOP policy agenda.

Trump probably didn’t help matters at a White House meeting Wednesday, when he singled out Sen. Dean Heller (R-Nev.), whom White House officials seated next to the president, as well as Sens. Jerry Moran (R-Kan.) and Mike Lee (R-Utah), for their opposition to the health-care bill. In each case, he cracked jokes that doubled as veiled threats that their political futures could stumble if they cross him.

Flake has decided to stay the course and remain a Trump antagonist whenever he feels that the president has crossed a line.

“I have no doubt I can make my life, as far as reelection, a lot easier if I was just a go-along-to-get-along guy. But, you know, it’s not worth it. It’s not worth it to be here if you’re not going to try to accomplish something,” Flake said Wednesday in an interview.

Unlike his potential challengers, Flake has decided not to discuss his 2018 reelection with anyone inside the White House, not even his close friend Vice President Pence.

Flake and Pence arrived together in Congress in 2001, becoming fast friends as rebels against an iron-fisted leadership team of House Republicans. In Flake’s view, he was more of a rebel in those days toward House Republican leaders and President George W. Bush’s White House than he is today.

“I opposed No Child Left Behind, the president’s signature initiative, along with Mike Pence; I opposed the prescription-drug benefit, the president’s signature initiative, along with Mike Pence,” Flake said. “I opposed the president’s Cuba policy for eight years.”

Did that make him a pariah to Bush?

“President Bush came and did a fundraiser for me,” Flake said. “I [voted] with him most of the time, and that’s how the White House usually works. They realize that no senator is there as a rubber stamp.”

White House officials have tried to deny that Trump has intended to threaten senators.

“There’s not a sense of a veiled threat,” Marc Short, Trump’s director of legislative affairs, said at Wednesday’s White House news briefing. “The president’s been pretty direct in his words, and he’s right now saying, ‘This is what you promised.’ ”

Short said Trump would campaign for Heller and any other Republican who wants him during next year’s midterm elections.

Flake believes he has done little to anger Trump this year. He counts one vote against Trump’s position — “the Russia thing,” as he put it, when he was part of a 97-to-2 roll call supporting tougher sanctions against Russia.

GOP leaders do not appreciate the stories about White House meddling in the Arizona primary. “I don’t think that’s productive, particularly right now,” Sen. John Cornyn (R-Tex.), the majority whip, said Wednesday.

The former chairman of the National Republican Senatorial Committee, Cornyn fought with factions of the party over primaries and does not think it’s useful. But he said that he has not had time to talk to White House officials about Flake and other Senate primaries.

That Flake, 54, has morphed from a House rabble-rouser into some sort of moderate establishment figure in the Senate says more about today’s conservative movement than his own ideology.

So much of the ethos seems to be about anger and political posture, how much a Republican is willing to scream into the wind — or, more to the point, on cable news — promising absolute confrontation.

And that, without question, is not Flake’s demeanor. His Democratic colleagues still recall that his first Senate speech was about comity and working together. He possesses a near-constant smile, even when expressing deep regret.

Flake is, in his demeanor, possibly the most anti-Trump member of the Senate.

He has embraced his senior senator, John McCain (R-Ariz.), as a mentor in his bipartisan approach and wariness toward Trump. Flake campaigned furiously on McCain’s behalf last summer during his own primary challenge, prompting the mischievous 80-year-old to often joke that if he only had Flake’s looks, he would be president by now.

McCain said he wants to return the favor for Flake on the trail next year, but that came into question with his brain cancer diagnosis late Wednesday that shook the Senate and left it unclear when McCain could return to work.

He counts Sen. Tim Kaine (D-Va.) as a text-messaging buddy. When Kaine was picked as the Democrats’ 2016 vice presidential nominee, Flake joked on Twitter that he was “counting the ways I hate” Kaine.

“Drawing a blank,” he wrote as a way to congratulate his “good friend.”

On Tuesday, Flake defended one of his Democratic challengers, Deedra Abboud, from hateful messages posted on her Facebook page because she is Muslim. “Sorry you have to put up with this. Lots of wonderful people across AZ. You’ll find them,” he wrote.

“He wears his decency on his sleeve often, and that can’t be said of everybody around here,” said Sen. Chris Murphy (D-Conn.).

Kaine, Murphy and Flake are part of the class of 2012, a group that has forged an old-fashioned bipartisan bond even as they joust over policy.

That set up a clash with Trump from the very beginning, when he launched his campaign in the summer of 2015 by targeting undocumented Mexican immigrants.

“The first one, the comment, I think the first day, about Mexican rapists,” Flake recalled Wednesday. “It was just, I thought, uncalled for.”

A few weeks later, Trump demeaned McCain’s military service for getting shot down over Vietnam. By the summer of 2016, at a Trump meeting with Senate Republicans, Flake challenged Trump from the outset.

“I’m the other senator from Arizona — the one that wasn’t captured,” he said in the private meeting.

He never endorsed Trump, and by the time an “Access Hollywood” tape was released in October 2016, revealing Trump’s comments about groping women, Flake called for him to withdraw from the race.

“If the president wants to recruit a primary opponent, that’s his prerogative. He can do that,” Flake said, having begun a full-fledged effort to build a strong campaign for next year. “I’ve had issues with other Republican presidents on policy, maybe not as many. But anyway, that’s what you do if you’re a senator. That’s what you should do.”

Read more from Paul Kane’s archive, follow him on Twitter or subscribe to his updates on Facebook.